Skip to main content

GET /products//reviews

Get published reviews for a specific product.

Authentication

None required.

Path Parameters

ParameterTypeDescription
idintegerProduct ID

Query Parameters

ParameterTypeRequiredDescription
per_pageintegerNoReviews 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

StatusDescription
404Product 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

ParameterTypeDescription
idintegerProduct 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

StatusDescription
404Product 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

ParameterTypeDescription
idintegerProduct ID

Headers

HeaderValueRequired
AuthorizationBearer Yes
Content-Typeapplication/jsonYes

Body Parameters

ParameterTypeRequiredDescription
ratingintegerYesRating from 1 to 5
commentstringYesReview 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

StatusDescription
400Already reviewed this product
401Not authenticated
403Customer has not purchased this product (only completed orders qualify)
404Product not found
422Validation 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

ParameterTypeDescription
idintegerProduct 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

StatusDescription
401Not authenticated
404Review not found