This API allows to reserve a book.
The API is available at https://simple-books-api.glitch.me
GET /
Returns the Message of the API.
GET /status
Returns the status of the API.
GET /books
Returns a list of books. ###Filter books List###
GET /books?type=non-fiction
Returns a list of books based on types.
Optional query parameters:
- type: fiction or non-fiction
GET books/id
Retrieve detailed information about a book.
To submit or view an order, you need to register your API client.
POST /api-clients/
The request body needs to be in JSON format and include the following properties:
clientName
- StringclientEmail
- String
Example
{
"clientName": "Reza",
"clientEmail": "rezoanul@example.com"
}
The response body will contain the access token. The access token is valid for 7 days.
Possible errors
Status code 409 means conflict - "API client already registered." Try changing the values for clientEmail
and clientName
to something else.
POST /orders
Allows you to submit a new order. Requires authentication.
The request body needs to be in JSON format and include the following properties:
bookId
- Integer - RequiredcustomerName
- String - Required
Example
POST /orders/
Authorization: Bearer <YOUR TOKEN>
{
"bookId": 1,
"customerName": "Rakib"
}
The response body will contain the order Id.
GET /orders
Allows you to view all orders. Requires authentication.
GET /orders/orderId
Allows you to view an existing order. Requires authentication.
PATCH /orders/orderId
Update an existing order. Requires authentication.
The request body needs to be in JSON format and allows you to update the following properties:
customerName
- String
Example
PATCH /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer <YOUR TOKEN>
{
"customerName": "Rakibul Islam"
}
DELETE /orders/orderId
Delete an existing order. Requires authentication.
The request body needs to be empty.
Example
DELETE /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer <YOUR TOKEN>