Skip to main content

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

ParameterTypeRequiredDescription
slugstringYesURL-friendly product identifier

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page (default: 10)
offsetintegerNumber of results to skip before returning results (default: 0)
orderingstringField to order results by. Prefix with - for descending (e.g., rating, -created_at)
rating_minintegerMinimum rating filter (1-5)
rating_maxintegerMaximum rating filter (1-5)
id_minintegerMinimum ID filter
id_maxintegerMaximum ID filter
created_datestringFilter by creation date (e.g., 2023-01-01)
updated_datestringFilter by last updated date (e.g., 2023-01-01)
created_fromstringFilter by creation date range start (e.g., 2023-01-01)
created_tostringFilter by creation date range end (e.g., 2023-01-31)
updated_fromstringFilter by last updated date range start (e.g., 2023-01-01)
updated_tostringFilter by last updated date range end (e.g., 2023-01-31)

Example Requests

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())

Status Codes

CodeDescription
200Product comments retrieved successfully
404Product not found
500Internal server error

Response Fields

FieldTypeDescription
idintegerUnique ID of the comment
ratingintegerRating given (1-5: Worst, Bad, Average, Good, Best)
contentstringComment content (max 500 characters)
user_dataobjectUser details (read-only)
truncated_contentstringShortened version of content
created_atstring (ISO 8601)Timestamp when comment was created
updated_atstring (ISO 8601)Timestamp when comment was last updated

User Data Structure

FieldTypeDescription
idintegerUnique ID of the user
usernamestringUsername of the user
full_namestringFull name of the user
avatarstringURL of the user avatar image