get by book
Reviews
get by book
Get Book Reviews
This endpoint retrieves a list of reviews for a specific book.
Request
- Method: GET
- URL: /reviews/book/:bookId
- Query Parameters:
- page (number, optional): The page number for paginated results.
- limit (number, optional): The maximum number of reviews to be returned per page.
Response
The response will contain an array of review objects, along with pagination information. Each review object includes the following fields:
- _id (string): The unique identifier for the review.
- book (string): The identifier of the book the review is for.
- review (string): The text content of the review.
- reviewer (string): The name of the reviewer.
- rating (number): The rating given to the book in the review.
- upvoters (array): An array of user identifiers who have upvoted the review.
- downvoters (array): An array of user identifiers who have downvoted the review.
- isRemoved (boolean): Indicates whether the review has been removed.
- createdAt (string): The timestamp when the review was created.
- updatedAt (string): The timestamp when the review was last updated.
- __v (number): Version key.
In case of no reviews found, the response will include an empty array for the “docs” field and 0 for all pagination-related fields.
Example
{
"data": {
"reviews": {
"docs": [],
"totalDocs": 0,
"offset": 0,
"limit": 0,
"totalPages": 0,
"page": 0,
"pagingCounter": 0,
"hasPrevPage": true,
"hasNextPage": true,
"prevPage": null,
"nextPage": null
},
"error": null
}
}
GET
get by book