List Product Reviews
Retrieve all reviews for a specific product.Authentication
This endpoint does not require authentication. It is publicly accessible.Path Parameters
The unique identifier of the product
Response
Returns an array of review objects.Unique review identifier
Username of the reviewer
The review content/comments
Rating value (1-5):
- 1: Very Bad
- 2: Unsatisfied
- 3: Just There
- 4: Satisfied
- 5: Very Satisfied
Analyzed sentiment of the review (can be null):
POSITIVE- Positive sentimentNeutral- Neutral sentimentNegative- Negative sentiment
Numerical sentiment score between -1 and 1 (can be null)
- Positive values indicate positive sentiment
- Negative values indicate negative sentiment
Whether the review is active and visible
ISO 8601 timestamp of review creation
ISO 8601 timestamp of last update
Array of images attached to the review
Request Example
Response Example
200 OK
Error Responses
Product with the specified ID does not exist
Create Product Review
Add a new review for a product. Only authenticated customers who have purchased the product can post reviews.Authentication
Required: User must be authenticated with a valid JWT token.Path Parameters
The unique identifier of the product
Request Body
The review content/comments
Rating value (1-5):
- 1: Very Bad
- 2: Unsatisfied
- 3: Just There
- 4: Satisfied
- 5: Very Satisfied
Request Example
Response Example
201 Created
Error Responses
Invalid request data or user hasn’t purchased the productOr with validation errors:
Authentication credentials were not provided or are invalid
Product with the specified ID does not exist
Get Specific Review
Retrieve a single review by its ID.Authentication
This endpoint does not require authentication. It is publicly accessible.Path Parameters
The unique identifier of the product
The unique identifier of the review
Request Example
Response Example
200 OK
Error Responses
Product or review with the specified ID does not exist
Update Review
Update an existing review. Only the review author can update their own review.Authentication
Required: User must be authenticated and must be the author of the review.Path Parameters
The unique identifier of the product
The unique identifier of the review
Request Body
The updated review content/comments
Updated rating value (1-5)
Request Example
Response Example
200 OK
Error Responses
Invalid request data
Authentication credentials were not provided
User is not the author of the review
Product or review with the specified ID does not exist
Delete Review
Delete a review. Only the review author can delete their own review.Authentication
Required: User must be authenticated and must be the author of the review.Path Parameters
The unique identifier of the product
The unique identifier of the review
Request Example
Response Example
204 No Content
Error Responses
Authentication credentials were not provided
User is not the author of the review
Product or review with the specified ID does not exist
Review Rules and Validation
Rating Scale
Reviews use a 5-point rating scale:- Very Bad (1) - Extremely dissatisfied
- Unsatisfied (2) - Below expectations
- Just There (3) - Meets basic expectations
- Satisfied (4) - Meets or slightly exceeds expectations
- Very Satisfied (5) - Exceeds expectations significantly
Review Requirements
- Purchase Verification: Users can only review products they have purchased
- Authentication: Creating, updating, and deleting reviews requires authentication
- Ownership: Users can only update or delete their own reviews
- One Review Per User: Each user can only post one review per product (enforced at application level)
Automatic Features
- Product Rating Update: Product’s average rating is automatically recalculated when reviews are added, updated, or deleted
- Sentiment Analysis: Reviews may undergo automatic sentiment analysis to populate
sentimentandsentiment_scorefields - Timestamp Tracking: Creation and update timestamps are automatically maintained
Content Guidelines
- Review Text: Should be descriptive and provide useful information to other customers
- Minimum Length: While not enforced at API level, reviews should be substantive
- Prohibited Content: Reviews containing inappropriate content may be marked as inactive by administrators
Notes
- Reviews are sorted by creation date (most recent first) by default
- The
is_activeflag allows administrators to hide inappropriate reviews without deletion - Sentiment analysis is performed automatically but may be null for older reviews
- Product ratings are calculated as the average of all active review ratings
- Review images are optional and managed separately from the review text
- Deleting a review permanently removes it from the database
- The product’s rating field is updated asynchronously after review operations