Getting Started
An intro to our API
Welcome to our API!
This API document is designed for those interested in developing for our platform.
This API is still under development and will evolve.
Authentication
You need to be authenticated for all API requests. You can generate an API key in your developer dashboard.
Add the API key to all requests as a GET parameter.
$.get('http://api.myapp.com/books/', { token: 'YOUR_APP_KEY'}, function(data) { alert(data); });
curl http://api.myapp.com/books?token=YOUR_APP_KEY
Errors
Code | Name | Description |
---|---|---|
200 | OK | Success |
201 | Created | Creation successful |
400 | Bad Request | We could not process that action |
403 | Forbidden | We couldn't authenticate you |
All errors will return JSON in the following format:
{ error: true, message: "error message here" }
/books
List all books
List Book Format
- offset
-
integer
Offset the results by this amount - limit
-
integer
Limit the number of books returned
Lists all the photos you have access to. You can paginate by using the parameters listed above.
$.get('http://api.myapp.com/books/', { token: 'YOUR_APP_KEY'}, function(data) { alert(data); });
r = requests.get('http://api.myapp.com/books/', token="YOUR_APP_KEY") print r.text
var request = require('request'); request('http://api.myapp.com/books?token=YOUR_APP_KEY', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } })
curl http://sampleapi.readme.com/orders?key=YOUR_APP_KEY
[ { "id": 1, "title": "The Hunger Games", "score": 4.5, "date_added": "12/12/2013" }, { "id": 1, "title": "The Hunger Games", "score": 4.7, "date_added": "15/12/2013" }, ]
/books
Create Book
Create Book Format
- title
-
string
The title for the book - score
-
float
The book's score between 0 and 5
Adds a book to your collection.
$.post('http://api.myapp.com/books/', { token: 'YOUR_APP_KEY', title: "The Book Thief", score: 4.3 }, function(data) { alert(data); });
{ "id": 3, "title": "The Book Thief", "score": 4.3, "date_added": "5/1/2015" }
/books/:id
Get Book
Returns a specific book from your collection
$.get('http://api.myapp.com/books/3', { token: 'YOUR_APP_KEY', }, function(data) { alert(data); });
{ "id": 3, "title": "The Book Thief", "score": 4.3, "date_added": "5/1/2015" }
/books/:id
Update Book
Update Book Format
- title
-
string
The title for the book - score
-
float
The book's score between 0 and 5
Update an existing book in your collection.
$.ajax({ url: 'http://api.myapp.com/books/3' type: 'PUT', data: { token: 'YOUR_APP_KEY', score: 5.0, title: "The Book Stealer" }, success: function(data) { alert(data); });
{ "id": 3, "title": "The Book Stealer", "score": 5, "date_added": "5/1/2015" }
/books/:id
Deletes a book
Deletes a book in your collection.
$.ajax({ url: 'http://api.myapp.com/books/3' type: 'DELETE', data: { token: 'YOUR_APP_KEY' }, success: function(data) { alert(data); });
{ "id": 3, "status": "deleted" }