GET /api/v1/books/price
Description:
This endpoint allows users to retrieve a list of books within a specified price range and other pagination parameters.
Parameters:
page: Page number for pagination. Default is1(int).limit: Number of books per page. Default is10(int).sort_type: Type of sorting based on a book characteristic. Default isprice(str).sort_order: Sorting order of the results.1for ascending and-1for descending. Default is1(int).min_price: Minimum price of the books to be retrieved. Default is0(int).max_price: Maximum price of the books to be retrieved. Default isno max price(int).
Request
Response
The response will show first the lower prices (ascending order is 1 and it was the order provided). Also will only show the books within the price range of 50 and 60. The results will be only for the page 1 and the limit will be 20 results. (because, they're only 2 results to show, that parameterization won't make a difference)
{
"books": [
{
"_id": "6651c712fe5f5504f6bb05e0",
"title": "Designing Hard Software",
"price": 54.99
// More book information
},
{
"_id": "6651c712fe5f5504f6bb05dd",
"title": "Java Persistence with Hibernate",
"price": 59.32
// More book information
}
],
"pageCurrent": 1,
"pagePrevious": null,
"pageNext": null,
"pageLast": 1,
"items": 2
}