GET /products//reviews
Get published reviews for a specific product.
Authentication
None required.
Path Parameters
| Parameter | Type | Description |
|---|
| id | integer | Product ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|
| per_page | integer | No | Reviews per page (1-50). Default: 10 |
Example Request
curl "https://front.rmz.gg/api/products/101/reviews?per_page=10"
Response
Success (200)
{
"success": true,
"data": [
{
"id": 1,
"rating": 5,
"comment": "Excellent product, received instantly!",
"is_published": true,
"reviewer": {
"id": 123,
"name": "Ahmed Ali",
"first_name": "Ahmed",
"last_name": "Ali"
},
"product": {
"id": 101,
"type": "App\\Models\\StoreProduct"
},
"created_at": "2024-06-15T10:30:00.000000Z",
"updated_at": "2024-06-15T10:30:00.000000Z"
}
],
"pagination": {
"current_page": 1,
"last_page": 3,
"per_page": 10,
"total": 25,
"from": 1,
"to": 10,
"has_more_pages": true,
"next_page_url": "...",
"prev_page_url": null
}
}
Error Responses
| Status | Description |
|---|
| 404 | Product not found |
GET /products//reviews/stats
Get review statistics for a specific product including total count, average rating, and distribution.
Authentication
None required.
Path Parameters
| Parameter | Type | Description |
|---|
| id | integer | Product ID |
Example Request
curl "https://front.rmz.gg/api/products/101/reviews/stats"
Response
Success (200)
{
"success": true,
"data": {
"total_reviews": 142,
"average_rating": 4.7,
"rating_distribution": {
"1": 2,
"2": 5,
"3": 15,
"4": 38,
"5": 82
}
}
}
Error Responses
| Status | Description |
|---|
| 404 | Product not found |
POST /products//reviews
Submit a review for a product. The customer must have purchased and received the product (completed order).
Authentication
Requires Bearer token (auth:customer_api).
Path Parameters
| Parameter | Type | Description |
|---|
| id | integer | Product ID |
| Header | Value | Required |
|---|
| Authorization | Bearer | Yes |
| Content-Type | application/json | Yes |
Body Parameters
| Parameter | Type | Required | Description |
|---|
| rating | integer | Yes | Rating from 1 to 5 |
| comment | string | Yes | Review text (max 1000 characters) |
Example Request
curl -X POST "https://front.rmz.gg/api/products/101/reviews" \
-H "Authorization: Bearer 1|abc123xyz..." \
-H "Content-Type: application/json" \
-d '{
"rating": 5,
"comment": "Excellent product, received instantly!"
}'
Response
Success (200)
{
"success": true,
"data": {
"id": 50,
"rating": 5,
"comment": "Excellent product, received instantly!",
"is_published": false,
"reviewer": null,
"product": {
"id": 101,
"type": "App\\Models\\StoreProduct"
},
"created_at": "2024-06-15T10:30:00.000000Z",
"updated_at": "2024-06-15T10:30:00.000000Z"
},
"message": "Review submitted successfully"
}
Reviews are submitted with is_published: false and require store owner approval before they appear publicly.
Error Responses
| Status | Description |
|---|
| 400 | Already reviewed this product |
| 401 | Not authenticated |
| 403 | Customer has not purchased this product (only completed orders qualify) |
| 404 | Product not found |
| 422 | Validation error (missing rating/comment, rating out of range) |
GET /customer/reviews/
Get the authenticated customer’s review for a specific product.
Authentication
Requires Bearer token (auth:customer_api).
Path Parameters
| Parameter | Type | Description |
|---|
| id | integer | Product ID |
Example Request
curl "https://front.rmz.gg/api/customer/reviews/101" \
-H "Authorization: Bearer 1|abc123xyz..."
Response
Success (200)
{
"success": true,
"data": {
"id": 50,
"rating": 5,
"comment": "Excellent product, received instantly!",
"is_published": true,
"reviewer": null,
"product": {
"id": 101,
"type": "App\\Models\\StoreProduct"
},
"created_at": "2024-06-15T10:30:00.000000Z",
"updated_at": "2024-06-15T10:30:00.000000Z"
}
}
Error Responses
| Status | Description |
|---|
| 401 | Not authenticated |
| 404 | Review not found |