Get Comments by Product ID
Fetch a paginated list of comments and their replies for a specific product using its ID. This endpoint helps retrieve customer feedback, discussions, and nested replies associated with a product. Pagination parameters (page and limit) allow you to control the volume and order of the retrieved comment data.
Requirements
productIdis required.- Pagination is supported via
pageandlimit.
Usage
Request
- Method:
GET - Path:
/products/{productId}/comments
Path Parameters
| Name | Type | Required | Example | Description |
|-----------|--------|----------|---------|-------------|
| productId | string | Yes | 3fa85f64-5717-4562-b3fc-2c963f66afa6 | Unique product ID (UUID). |
Query Parameters
| Name | Type | Required | Example | Description |
|------|--------|----------|---------|-------------|
| page | number | No | 1 | Page number (starting from 1). |
| limit | number | No | 20 | Number of comments per page. |
Example
curl -X GET "https://api.example.com/products/3fa85f64-5717-4562-b3fc-2c963f66afa6/comments?page=1&limit=20"
Response
200 OK
Returns a standard API envelope containing comment items and pagination metadata.
Example:
{
"status": true,
"path": "string",
"statusCode": 0,
"message": "string",
"data": {
"items": [
{
"id": "string",
"product_id": "string",
"comment": "string",
"isReply": true,
"isActive": true,
"isSpam": true,
"isDeleted": true,
"isReport": true,
"likes": "Unknown Type: integer,null",
"user_id": "string",
"user_meta": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"user_name": "string",
"profile_image": "string",
"join_as": "string",
"user_status": "string",
"about_me": "string",
"city": "string",
"zone": "string",
"country": "string",
"zip_code": "string",
"created_at": "string",
"updated_at": "string"
},
"created_at": "string",
"updated_at": "string",
"reply_to": "Unknown Type: string,null",
"replies": [
{
"id": "string",
"product_id": "string",
"comment": "string",
"isReply": true,
"isActive": true,
"isSpam": true,
"isDeleted": true,
"isReport": true,
"likes": "Unknown Type: integer,null",
"user_id": "string",
"user_meta": {
"id": "string",
"email": "string",
"first_name": "string",
"last_name": "string",
"user_name": "string",
"profile_image": "string",
"join_as": "string",
"user_status": "string",
"created_at": "string",
"updated_at": "string"
},
"created_at": "string",
"updated_at": "string",
"reply_to": "Unknown Type: string,null"
}
]
}
],
"pagination": {
"current_page": 0,
"per_page": 0,
"total_count": 0,
"total_pages": 0,
"last_page": 0
}
}
}
Notes
- The main comments are returned in
data.items. - Nested replies for each comment are returned in
item.replies. reply_toandlikesare returned as"Unknown Type: ... ,null"in the schema; treat them as nullable fields in your implementation.- Pagination info is returned in
data.pagination:current_page,per_page,total_count,total_pages,last_page.