Retrieve Product Comment
Retrieves detailed information about a specific product comment by its ID.
HTTP Request
GET/api/products/comments/:id
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | integer | Yes | Unique ID of the product comment |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3response = requests.get('http://www.example.com/api/products/comments/123',
4 headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())1curl "http://www.example.com/api/products/comments/123" -H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Product comment retrieved successfully |
| 401 | Unauthorized — authentication required |
| 403 | Forbidden — insufficient permissions |
| 404 | Product comment 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) |
| is_anonymous | boolean | Whether the comment is posted anonymously |
| is_published | boolean | Whether the comment is published |
| user_data | object | User details (read-only) |
| product_data | object | Product 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 |
Product Data Structure
| Field | Type | Description |
|---|---|---|
| id | integer | Unique ID of the product |
| name | string | Name of the product |
Notes
- This endpoint returns a single comment object with full details
- Anonymous comments will show user_data as null or limited information
- All timestamps are in ISO 8601 format (e.g., "2023-01-01T12:00:00Z")