Reviews API
Product review system with ratings, comments, and user associations.
List Reviews
Get a paginated list of reviews with optional filtering by product and user.
GET https://responserift.dev/api/reviews?productId=1&userId=2&limit=5&offset=0
Query Parameters
productId
- Filter reviews by product IDuserId
- Filter reviews by user IDlimit
- Number of results (default: 100)offset
- Number of results to skip (default: 0)
Response
{
"total": 15,
"limit": 5,
"offset": 0,
"results": [
{
"id": 1,
"productId": 1,
"userId": 2,
"rating": 5,
"comment": "Excellent product! Great quality and fast shipping.",
"createdAt": "2024-01-15T14:30:00.000Z"
}
]
}
Get Review
Retrieve a specific review by ID.
GET https://responserift.dev/api/reviews/1
Create Review
Create a new product review. All fields are required.
POST https://responserift.dev/api/reviews
Content-Type: application/json
{
"productId": 1,
"userId": 2,
"rating": 5,
"comment": "Amazing product! Exceeded my expectations."
}
Required fields: productId, userId, rating, comment
Rating validation: Must be between 1 and 5 (inclusive)
Auto-generated: createdAt (current timestamp)
Update Review
Update an existing review. Only provided fields will be updated.
PUT https://responserift.dev/api/reviews/1
Content-Type: application/json
{ "rating": 4, "comment": "Updated comment with more details." }
Delete Review
Remove a review from the system.
DELETE https://responserift.dev/api/reviews/1
Product-Specific Reviews
Access reviews for a specific product through the nested endpoint.
List Product Reviews
GET https://responserift.dev/api/products/1/reviews
Create Product Review
POST https://responserift.dev/api/products/1/reviews
Content-Type: application/json
{
"userId": 2,
"rating": 5,
"comment": "Great product! Highly recommend."
}
Note: When using the nested endpoint, productId is automatically set from the URL path.
Review Structure
Fields
id
- Unique review identifierproductId
- ID of the product being revieweduserId
- ID of the user who wrote the reviewrating
- Star rating (1-5)comment
- Text content of the reviewcreatedAt
- ISO timestamp when review was created
Warning: All mutations are in-memory only and reset on server restart.