This REST API allows you to reserve a book. This API is fully founctional with SQL calls to Neon Database and deployed on Vercel.
It mirrors the funtionality available at Simple Book Api.
GET /status
Returns the status of the API.
GET /books
Returns a list of books.
Optional query parameters:
GET /books/:bookId
Retrieve detailed information about a book.
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:
Example
POST /orders/
Authorization: Bearer <TOKEN>
{
"bookId": "1",
"customerName": "John"
}
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:
Example
PATCH /orders/PF6Mfl
Authorization: Bearer <TOKEN>
{
"customerName": "John"
}
DELETE /orders/:orderId
The request body needs to be empty.
Delete an existing order. Requires authentication.
Example
DELETE /orders/PF6Mfl
Authorization: Bearer <TOKEN>
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:
Example
{
"clientName": "user",
"clientEmail": "test@test.com"
}
The response body will contain the access token. The access token is valid for 7 days.
Status code 409 - `"`API client already registered.`"` Try changing the values for clientEmail and clientName to something else.