Backend of website for book database of LGBT literature in Czech language.
GET /api/books/info
- FULLY IMPLEMENTED
GET /api/books/filterParams
- FULLY IMPLEMENTED
GET /api/books
- FULLY IMPLEMENTED
GET /api/books/:slug
- FULLY IMPLEMENTED
GET /api/books/random
- FULLY IMPLEMENTED
Condition: Generic server error
Code: 500 INTERNAL SERVER ERROR
Content example:
{
"detail": "Connection to database has failed"
}
Gets information about the whole database.
URL: /api/books/info
Method: GET
Condition: If information have been successfully returned
Code: 200 SUCCESS
Content example:
{
"totalBooks": 214,
"dateOfLastBookAddition": "2020-01-01"
}
Returns parameters which can be used to filter books (see Show List Of Books for more details).
URL: /api/books/filterParams
Method: GET
Condition: If filter parameters have been successfully returned
Code: 200 SUCCESS
Content example:
{
"originalLanguage": [
{
"booksMatchesValue": 34,
"slug": "cestina",
"name": "čeština"
},
{
"booksMatchesValue": 2,
"slug": "anglictina",
"name": "angličtina"
}
],
"bookSize": [
{
"slug": "kratka",
"minPages": null,
"maxPages": 100,
"booksMatchesValue": 5,
"name": "krátká"
},
{
"slug": "stredni",
"minPages": 100,
"maxPages": 200,
"booksMatchesValue": 10,
"name": "střední"
},
{
"slug": "stredni",
"minPages": 300,
"maxPages": null,
"booksMatchesValue": 63,
"name": "dlouhá"
}
],
"tags": [
{
"name": "Gay",
"slug": "gay",
"booksMatchesValue": 45
},
{
"name": "Zahraniční",
"slug": "zahranicni",
"booksMatchesValue": 31
}
]
}
Returns list of books by specified parameters. If no parameters specified, returns list of all books ordered by title.
URL: /api/books?orderBy={orderBy}&order={order}&page={page}&size={size}&tags={tags[]}&originalLanguage={originalLanguage}&bookSize={bookSize}
Method: GET
URL parameters
URL Parameter | Required | Description | Possible Values | Default |
---|---|---|---|---|
orderBy |
no | Key to order the list of books by | TITLE DATE_OF_ADDITION YEAR_OF_ISSUE |
DATE_OF_ADDITION |
order |
no | Specifies order direction | ASC DESC |
ASC |
page |
no | Number of required page | <integer> above 0 |
0 |
size |
no | Number of books at one page | <integer> above 0 |
the last index in DB |
tags |
no | Filter based on tags (AND) | <string[]> , example tags=gay,zahranicni |
N/A |
originalLanguage |
no | Filter based on original languages (OR) | <string> , example originalLanguages=anglictina |
N/A |
bookSize |
no | Filter based on book sizes (OR) | <string> , example bookSizes=kratka |
N/A |
Condition: If data can be successfully returned
Code: 200 SUCCESS
Content example:
{
"total": 211,
"books": [
{
"title": "Obraz Doriana Graye",
"yearOfIssue": 2018,
"dateOfAddition": "2020-01-01",
"imageURL": "/images/jhsu87r.jpeg",
"tags": [
{
"name": "Gay",
"slug": "gay",
"color": "red"
},
{
"name": "Zahraniční",
"slug": "zahranicni",
"color": "purple"
}
],
"slug": "obraz-doriana-graye-2018",
"author": {
"firstName": "Oscar",
"lastName": "Wilde"
}
}
]
}
Condition: If there are no books for given page indexes
Code: 404 NOT FOUND
Content example:
{
"detail": "No data found for given parameters"
}
Show all details of given book.
URL: /api/books/{slug}
Method: GET
URL parameters
URL Parameter | Required | Description | Possible Values | Default |
---|---|---|---|---|
slug |
yes | Book slug | non empty <string> |
N/A |
Condition: If data can be successfully returned
Code: 200 SUCCESS
Content example
{
"slug": "obraz-doriana-graye-2018",
"title": "Obraz Doriana Graye",
"author": {
"firstName": "Oscar",
"lastName": "Wilde"
},
"yearOfIssue": 2018,
"dateOfAddition": "2020-01-01",
"imageURL": "/images/jhsu87r.jpeg",
"tags": [
{
"slug": "gay",
"name": "Gay",
"color": "red"
},
{
"slug": "zahranicni",
"name": "Zahraniční",
"color" "purple"
}
],
"description": "Příběh s utopickými prvky se odehrává v 19. století v Londýně.\r\nJediná rozsáhlejší próza Oscara Wilda předvádí na fantastickém příběhu aristokrata, jemuž kouzelná moc propůjčila věčnou krásu a mládí, rozpor mezi morálkou a estetickým prožitkem - zatímco Dorian Gray zůstává stále dvacetiletý, jeho dokonalá podoba na plátně stárne a ohyzdí se podle toho, kolik dívčích srdcí zlomil a kolik nadějných mladíků přivedl do zkázy.",
"ISBN": "978-80-207-1814-3",
"numberOfPages": 264,
"originalLanguage": "English",
"publisher": "Odeon",
"links": [
{
"cbdb": "https://www.cbdb.cz/kniha-2569-obraz-doriana-graye-picture-of-dorian-gray",
"goodreads": "https://www.goodreads.com/book/show/10545185-obraz-doriana-graye",
"dtabazeKnih": "https://www.databazeknih.cz/knihy/obraz-doriana-graye-3182"
}
]
}
Condition: If there is no book with given slug
Code: 404 NOT FOUND
Content example:
{
"detail": "No book matches the given slug"
}
Gets a random book.
URL: /api/books/random
Method: GET
Condition: If data can be successfully returned
Code: 200 SUCCESS
Content example:
Same as Book Details.
MIT