Dox Example
This api is implemented according to the JSON API spec.
Filter
If you want to filter your query, you can do so by setting the supported filter parameters in the following way:
?author_id=24
Books ¶
Book Collections ¶
Get book collectionsGET/api/v1/book_collections
Example URI
GET /api/v1/book_collections
Request
returns book collectionsGET /api/v1/book_collections
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": [
{
"id": "1",
"type": "book_collections",
"attributes": {
"name": "Book_collection_1"
},
"relationships": {
"books": {
"meta": {
"included": false
}
}
}
}
]
}Get a book collectionGET/api/v1/book_collections/{id}
Example URI
GET /api/v1/book_collections/1
URI Parameters
- id
number(required) Example: 1
Request
returns a book collectionGET /api/v1/book_collections/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "1",
"type": "book_collections",
"attributes": {
"name": "Book_collection_2"
},
"relationships": {
"books": {
"data": []
}
}
}
}Request
does not find a book collectionGET /api/v1/book_collections/invalid_id
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
404Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": []
}Create a book collectionPOST/api/v1/book_collections
Example URI
POST /api/v1/book_collections
Request
creates a new book collectionPOST /api/v1/book_collections
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book_collection",
"attributes": {
"name": "Book_collection_5"
}
}
}Response
201Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "2",
"type": "book_collections",
"attributes": {
"name": "Book_collection_5"
},
"relationships": {
"books": {
"meta": {
"included": false
}
}
}
}
}Request
returns unprocessable entityPOST /api/v1/book_collections
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book_collection",
"attributes": {
"name": ""
}
}
}Response
422Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": [
{
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"parameter": "name",
"pointer": "data/attributes/name"
}
}
]
}Update a book collectionPUT/api/v1/book_collections/{id}
Example URI
PUT /api/v1/book_collections/1
URI Parameters
- id
number(required) Example: 1
Request
updates the requested book collectionPUT /api/v1/book_collections/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book_collection",
"id": 1,
"attributes": {
"name": "New Book Collection"
}
}
}Response
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "1",
"type": "book_collections",
"attributes": {
"name": "New Book Collection"
},
"relationships": {
"books": {
"meta": {
"included": false
}
}
}
}
}Request
returns unprocessable entityPUT /api/v1/book_collections/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book_collection",
"id": 1,
"attributes": {
"name": ""
}
}
}Response
422Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": [
{
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"parameter": "name",
"pointer": "data/attributes/name"
}
}
]
}Delete a book collectionDELETE/api/v1/book_collections/{id}
Example URI
DELETE /api/v1/book_collections/1
URI Parameters
- id
number(required) Example: 1
Request
deletes the requested book collectionDELETE /api/v1/book_collections/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
204Books ¶
Supported filter params
- author_id
Get booksGET/api/v1/books
Example URI
GET /api/v1/books
Request
returns booksGET /api/v1/books
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": [
{
"id": "1",
"type": "books",
"attributes": {
"name": "Book_1"
},
"relationships": {
"author": {
"meta": {
"included": false
}
},
"book_collection": {
"meta": {
"included": false
}
}
}
}
]
}Get a bookGET/api/v1/books/{id}
Example URI
GET /api/v1/books/1
URI Parameters
- id
number(required) Example: 1
Request
returns a bookGET /api/v1/books/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "1",
"type": "books",
"attributes": {
"name": "Book_2"
},
"relationships": {
"author": {
"data": {
"type": "authors",
"id": "1"
}
},
"book_collection": {
"data": {
"type": "book_collections",
"id": "1"
}
}
}
},
"included": [
{
"id": "1",
"type": "authors",
"attributes": {
"name": "Author_11"
},
"relationships": {
"books": {
"meta": {
"included": false
}
}
}
},
{
"id": "1",
"type": "book_collections",
"attributes": {
"name": "Book_collection_11"
},
"relationships": {
"books": {
"meta": {
"included": false
}
}
}
}
]
}Request
does not return a bookGET /api/v1/books/invalid_id
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
404Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": []
}Create a bookPOST/api/v1/books
Example URI
POST /api/v1/books
Request
creates a new bookPOST /api/v1/books
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book",
"attributes": {
"name": "New Book",
"author_id": 1
}
}
}Response
201Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "2",
"type": "books",
"attributes": {
"name": "New Book"
},
"relationships": {
"author": {
"meta": {
"included": false
}
},
"book_collection": {
"meta": {
"included": false
}
}
}
}
}Request
returns unprocessable entityPOST /api/v1/books
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book",
"attributes": {
"name": ""
}
}
}Response
422Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": [
{
"title": "Unprocessable Entity",
"detail": "Author must exist",
"source": {
"parameter": "author",
"pointer": "data/attributes/author"
}
},
{
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"parameter": "name",
"pointer": "data/attributes/name"
}
}
]
}Request
doesn't create a new bookPOST /api/v1/books
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book",
"attributes": {
"name": ""
}
}
}Response
422Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": [
{
"title": "Unprocessable Entity",
"detail": "Author must exist",
"source": {
"parameter": "author",
"pointer": "data/attributes/author"
}
},
{
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"parameter": "name",
"pointer": "data/attributes/name"
}
}
]
}Update a bookPUT/api/v1/books/{id}
Example URI
PUT /api/v1/books/1
URI Parameters
- id
number(required) Example: 1
Request
updates the requested bookPUT /api/v1/books/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book",
"id": 1,
"attributes": {
"name": "New Book"
}
}
}Response
200Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"data": {
"id": "1",
"type": "books",
"attributes": {
"name": "New Book"
},
"relationships": {
"author": {
"meta": {
"included": false
}
},
"book_collection": {
"meta": {
"included": false
}
}
}
}
}Request
returns unprocessable entityPUT /api/v1/books/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonBody
{
"data": {
"type": "book",
"id": 1,
"attributes": {
"name": ""
}
}
}Response
422Headers
Content-Type: application/vnd.api+json; charset=utf-8Body
{
"errors": [
{
"title": "Unprocessable Entity",
"detail": "Name can't be blank",
"source": {
"parameter": "name",
"pointer": "data/attributes/name"
}
}
]
}Delete a bookDELETE/api/v1/books/{id}
Example URI
DELETE /api/v1/books/1
URI Parameters
- id
number(required) Example: 1
Request
deletes the requested bookDELETE /api/v1/books/1
Headers
Accept: application/vnd.api+json
Content-Type: application/vnd.api+jsonResponse
204