-
Notifications
You must be signed in to change notification settings - Fork 0
API DOCS
arifakkermans edited this page Dec 13, 2021
·
3 revisions
This API allows you to create a book.
GET /books
Returns a list of books.
Example response:
[
{
"release_date": "1995-02-10",
"languages": "English",
"book_name": "The Hitchhiker's Guide to the Galaxy",
"isbn": "9780575074842",
"number_of_pages": "224",
"countries": "US",
"authors": "Douglas Adams"
},
{
"release_date": "1949-02-10",
"languages": "English",
"book_name": "1984",
"isbn": "9780140862539",
"number_of_pages": "328",
"countries": "US",
"authors": "George Orwell"
}
]
GET /books/{isbn}
Retrieve detailed information about a book.
Example response:
GET /books/9780140862539
{
"name": "1984",
"isbn": "9780140862539",
"authors": "George Orwell",
"languages": "English",
"countries": "US",
"numberOfPages": "328",
"releaseDate": "1949-02-10"
}
POST /books
Allows you to create a new book.
The request body needs to be in JSON format and include the following properties:
-
isbn
- String - Required -
name
- String - Required -
authors
- String - Required -
languages
- String - Required -
countries
- String - Required -
numberOfPages
- String - Required -
releaseDate
- String (ISO 8601 standard)- Required
Example request body:
{
"name": "1984",
"isbn": "9780140862539",
"authors": "George Orwell",
"languages": "English",
"countries": "US",
"numberOfPages": "328",
"releaseDate": "1949-02-10"
}
Response body:
Location: /books/9780140862539
PUT /books/{isbn}
Example request body:
{
"name": "1984",
"isbn": "9780140862539",
"authors": "George Orwell",
"languages": "English, Dutch",
"countries": "UK",
"numberOfPages": "328",
"releaseDate": "1949-02-10"
}
Response body:
Location: /books/9780140862539
DELETE /books/{isbn}
Delete an existing book.
The request body needs to be empty.
Example
DELETE /books/9780140862539
Status code 400 - "Release date does not match YYYY-MM-DD (ISO 8601)."
Status code 400 - "Isbn must be a 13char digit."
Status code 400 - "request body malformed."
Status code 403 - "Book already exist."
Status code 404 - "Book does not exist."
Status code 418 - "I'm a teapot."