List Product Comments
Retrieves a list of comments for a specific product with filtering and ordering capabilities.
HTTP Request
GET/api/shop/products/:slug/comments
Authorization
Authorization
- Required: No
- Permission: Public
- Authentication: None
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| slug | string | Yes | URL-friendly product identifier |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | — | Number of results to return per page (default: 10) |
| offset | integer | — | Number of results to skip before returning results (default: 0) |
| ordering | string | — | Field to order results by. Prefix with - for descending (e.g., rating, -created_at) |
| rating_min | integer | — | Minimum rating filter (1-5) |
| rating_max | integer | — | Maximum rating filter (1-5) |
| id_min | integer | — | Minimum ID filter |
| id_max | integer | — | Maximum ID filter |
| created_date | string | — | Filter by creation date (e.g., 2023-01-01) |
| updated_date | string | — | Filter by last updated date (e.g., 2023-01-01) |
| created_from | string | — | Filter by creation date range start (e.g., 2023-01-01) |
| created_to | string | — | Filter by creation date range end (e.g., 2023-01-31) |
| updated_from | string | — | Filter by last updated date range start (e.g., 2023-01-01) |
| updated_to | string | — | Filter by last updated date range end (e.g., 2023-01-31) |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# List product comments with filters
4response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro/comments', params={
5 'limit': 20,
6 'ordering': '-created_at',
7 'rating_min': 4
8})
9print(response.json())
10
11# List all 5-star reviews
12response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro/comments', params={
13 'rating_min': 5,
14 'rating_max': 5,
15 'ordering': '-created_at'
16})
17print(response.json())1# List product comments with filters
2curl "http://www.example.com/api/shop/products/iphone-14-pro/comments?limit=20&ordering=-created_at&rating_min=4"
3
4# List comments from specific date range
5curl "http://www.example.com/api/shop/products/iphone-14-pro/comments?created_from=2023-01-01&created_to=2023-12-31&ordering=rating"Status Codes
| Code | Description |
|---|---|
| 200 | Product comments retrieved successfully |
| 404 | Product not found |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique ID of the comment |
| rating | integer | Rating given (1-5: Worst, Bad, Average, Good, Best) |
| content | string | Comment content (max 500 characters) |
| user_data | object | User details (read-only) |
| truncated_content | string | Shortened version of content |
| created_at | string (ISO 8601) | Timestamp when comment was created |
| updated_at | string (ISO 8601) | Timestamp when comment was last updated |
User Data Structure
| Field | Type | Description |
|---|---|---|
| id | integer | Unique ID of the user |
| username | string | Username of the user |
| full_name | string | Full name of the user |
| avatar | string | URL of the user avatar image |