83% found this document useful (6 votes)
3K views2 pages

Simple Books API

This API allows users to reserve books and manage orders through various endpoints. It provides functionality to get the API status, list books, get a single book, submit new orders, get all orders, update orders, delete orders, and authenticate API clients. Authentication is required to submit, view, update, or delete orders and uses JSON web tokens.

Uploaded by

sudeep pokhrel1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
83% found this document useful (6 votes)
3K views2 pages

Simple Books API

This API allows users to reserve books and manage orders through various endpoints. It provides functionality to get the API status, list books, get a single book, submit new orders, get all orders, update orders, delete orders, and authenticate API clients. Authentication is required to submit, view, update, or delete orders and uses JSON web tokens.

Uploaded by

sudeep pokhrel1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Simple Books API

This API allows you to reserve a book.

The API is available at https://simple-books-api.glitch.me

Endpoints
Status
GET /status
Returns the status of the API.

List of books
GET /books
Returns a list of books.

Optional query parameters:

 type: fiction or non-fiction


 limit: a number between 1 and 20.

Get a single book


GET /books/:bookId
Retrieve detailed information about a book.

Submit an order
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 - Required


 customerName - String - Required

Example

POST /orders/
Authorization: Bearer <YOUR TOKEN>

{
"bookId": 1,
"customerName": "John"
}
The response body will contain the access token.

Get all orders


GET /orders
Allows you to view all orders. Requires authentication.

Update an order
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": "John"
}

Delete an order
DELETE /orders/:orderId
Delete an existing order. Requires authentication.

The request body needs to be empty.

Example

DELETE /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer <YOUR TOKEN>

API Authentication
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 - String
 clientEmail - String

Example

{
"clientName": "Valentin",
"clientEmail": "[email protected]"
}
The response body will contain the access token.

You might also like