GET /books/
Example response:
[
{
"id": 1,
"title": "The Book Title",
"author": [
{
"id": 1,
"first_name": "John",
"last_name": "Smith"
}
],
"summary": "Short summary of the book.",
"genre": [
{
"id": 1,
"name": "Fantasy"
}
],
"image": "image_url",
"rating": 7.8,
"number_of_ratings": 230,
"book_review": [
{
"user": "Username",
"review": "Commentary on the book."
}
]
}
]
POST /books/
Example request body:
{
"title": "The Book Title",
"author": [
{
"id": 1
}
],
"summary": "Short summary of the book.",
"genre": [
{
"name": "Fantasy"
}
],
"image": "image_url"
}
Example response:
{
"id": 1,
"title": "The Book Title",
"author": [
{
"id": 1,
"first_name": "John",
"last_name": "Smith"
}
],
"summary": "Short summary of the book.",
"genre": [
{
"id": 1,
"name": "Fantasy"
}
],
"image": "image_url"
}
GET /books/<book_id>/
Example response:
{
"id": 1,
"title": "The Book Title",
"author": [
{
"id": 1,
"first_name": "John",
"last_name": "Smith"
}
],
"summary": "Short summary of the book.",
"genre": [
{
"id": 1,
"name": "Fantasy"
}
],
"image": "image_url",
"rating": 7.8,
"number_of_ratings": 230,
"book_review": [
{
"user": "Username",
"review": "Commentary on the book."
}
]
}
PATCH /books/<book_id>/
Example request body:
{
"title": "The Book Title",
"author": [
{
"id": 1
}
],
"summary": "Short summary of the book.",
"genre": [
{
"name": "Fantasy"
}
],
"image": "image_url"
}
Example response:
{
"id": 1,
"title": "The Book Title",
"author": [
{
"id": 1,
"first_name": "John",
"last_name": "Smith"
}
],
"summary": "Short summary of the book.",
"genre": [
{
"id": 1,
"name": "Fantasy"
}
],
"image": "image_url",
"rating": 7.8,
"number_of_ratings": 230,
"book_review": [
{
"user": "Username",
"review": "Commentary on the book."
}
]
}
DELETE /books/<book_id>/
GET /authors/
Example response:
[
{
"id": 1,
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author.",
"books": [
{
"id": 1,
"title": "The Book"
},
{
"id": 1,
"title": "New Book"
}
]
}
]
GET /authors/<author_id>/
Example response:
{
"id": 1,
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author.",
"books": [
{
"id": 1,
"title": "The Book"
},
{
"id": 2,
"title": "New Book"
}
]
}
POST /authors/<author_id>/
Example request body:
{
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author."
}
Example response:
{
"id": 1,
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author."
}
PATCH /authors/<author_id>/
Example request body:
{
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author."
}
Example response:
{
"id": 1,
"first_name": "John",
"last_name": "Smith",
"date_of_birth": "20/09/1923",
"date_of_death": "12/03/1987",
"description": "Short biography of the author."
}
DELETE /authors/<author_id>/
GET /genres/
Example response:
[
{
"id": 1,
"name": "Fantasy",
"books": [
{
"id": 1,
"title": "The Book"
},
{
"id": 2,
"title": "New Book"
}
]
}
]
POST /genres/
Example request body:
{
"name": "Fantasy"
}
Example response:
{
"id": 1,
"name": "Fantasy"
}
GET /genres/<genre_id>/
Example response:
{
"id": 1,
"name": "Fantasy",
"books": [
{
"id": 1,
"title": "The Book"
},
{
"id": 2,
"title": "New Book"
}
]
}
PATCH /genres/<genre_id>/
Example request body:
{
"name": "Fantasy"
}
Example response:
{
"id": 1,
"name": "Fantasy"
}
DELETE /genres/<genre_id>/
GET /reviews/
Example response:
[
{
"id": 1,
"book": {
"id": 1,
"title": "The Book"
},
"rating": 7,
"review": "Good"
}
]
POST /reviews/
Example request body:
{
"book": {
"id": 1
},
"rating": 7,
"review": "Good"
}
Example response:
{
"id": 1,
"book": {
"id": 1,
"title": "The Book"
},
"rating": 7,
"review": "Good"
}
GET /reviews/<review_id>/
Example response:
{
"id": 1,
"book": {
"id": 1,
"title": "The Book"
},
"rating": 7,
"review": "Good"
}
PATCH /reviews/<review_id>/
Example request body:
{
"book": {
"id": 1
},
"rating": 7,
"review": "Good"
}
Example response:
{
"id": 1,
"book": {
"id": 1,
"title": "The Book"
},
"rating": 7,
"review": "Good"
}
DELETE /review/<review_id>/