pressbooks/pressbooks — pull request #70 by bdolor (2014-08-21 22:53:11+00:00)
Title: PressBooks Api v1

This gives PB a (version 1) RESTful API.

Overview:
- The formats returned are json and xml. The default is json.
- Only public information is returned in a response, including only books and posts that are marked as public/published.
- No post content is returned
- Book Information, Table of Contents, Book ID (blog_id), and Book URL are returned

How to get it:
- there are two endpoints or base urls
1. http://somedomain/api/v1/books - will return return all relevant public information about a *collection* of books (on that PB instance)
2. http://somedomain/api/v1/books/12 - will return all relevant public information about a specific book with a blog_id = 12

There are seven arguments that can be passed, which filter the results:
titles, subjects, authors, licenses, keywords, limit, offset

For example, when searching a collection a request for:
`http://somedomain/api/v1/books?subjects=science&authors=brad&limit=3` will produce a json response with books matching that criteria (shown here in an array for readability)

![screen shot 2014-08-21 at 3 36 19 pm](https://cloud.githubusercontent.com/assets/2048170/4004599/b8746e5e-2983-11e4-969d-a0445274183b.png)

For example, when searching a specific book a request for:
`http://somedomain/api/v1/books/3?titles=data` will produce a json response of chapters matching that criteria (shown here in an array for readability)

![screen shot 2014-08-21 at 3 43 56 pm](https://cloud.githubusercontent.com/assets/2048170/4004655/affa5ba2-2984-11e4-87c3-5852440ee8a0.png)

The format of either of the responses can be modified by passing `?xml=1`. json format will display if either `?json=1` is passed or no format is specified (the default)

Developer documentation on how to use the API is planned for further iterations.