https://github.com/veena444/api-automation-using-postman
API Automation Using Postman & JavaScript
https://github.com/veena444/api-automation-using-postman
Last synced: 3 months ago
JSON representation
API Automation Using Postman & JavaScript
- Host: GitHub
- URL: https://github.com/veena444/api-automation-using-postman
- Owner: veena444
- Created: 2024-05-21T11:54:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-21T13:22:36.000Z (about 1 year ago)
- Last Synced: 2025-01-11T23:13:31.130Z (5 months ago)
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Books API
This API allows you to reserve a book.
The API is available at https://simple-books-api.glitch.me
Endpoints:
1.Status
GET /status
Returns the status of the API.
2.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.3.Get a single book
GET /books/:bookId
Retrieve detailed information about a book.
4.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
ExamplePOST /orders/
Authorization: Bearer{
"bookId": 1,
"customerName": "John"
}
The response body will contain the order Id.5.Get all orders
GET /orders
Allows you to view all orders. Requires authentication.
6.Get an order
GET /orders/:orderId
Allows you to view an existing order. Requires authentication.
7.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
ExamplePATCH /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer{
"customerName": "John"
}8.Delete an order
DELETE /orders/:orderId
Delete an existing order. Requires authentication.
The request body needs to be empty.
Example
DELETE /orders/PF6MflPDcuhWobZcgmJy5
Authorization: Bearer9.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": "John",
"clientEmail": "[email protected]"
}The response body will contain the access token. The access token is valid for 7 days.
Possible errors
Status code 409 - "API client already registered." Try changing the values for clientEmail and clientName to something else.