List Product Image
Retrieves a list of all images associated with a specific product.
HTTP Request
GET/api/products/:product_id/images
Authorization
Authorization
- Required: Yes
- Permission: Staff or Admin
- Authentication: Token-based (Authorization: Token <your_api_key>)
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| product_id | Integer | Yes | Unique ID of the product |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| limit | integer | 10 | Number of results to return per page |
| offset | integer | 0 | Number of results to skip before returning results |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# List all images for a specific product
4response = requests.get('http://www.example.com/api/products/123/images',
5 headers={'Authorization': 'Token <your_api_key>'}
6)
7print(response.json())
8
9# List images with pagination
10response = requests.get('http://www.example.com/api/products/123/images', params={
11 'limit': 20,
12 'offset': 0
13}, headers={'Authorization': 'Token <your_api_key>'})
14print(response.json())1# List all images for a specific product
2curl "http://www.example.com/api/products/123/images" -H "Authorization: Token <your_api_key>"
3
4# List images with pagination
5curl "http://www.example.com/api/products/123/images?limit=20&offset=0" \
6-H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Product images retrieved successfully |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 403 | Forbidden - Access denied |
| 404 | Not Found - Product not found |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | integer | Unique identifier for the image |
| type | string | Image type (e.g., "JPEG", "PNG", "WEBP") |
| user | object | User who uploaded the image |
| name | string | Original filename of the image |
| f | string | File URL/path |
| size | integer | File size in bytes |
| description | string | Image description |
| width | integer | Image width in pixels |
| height | integer | Image height in pixels |
| human_readable_size | string | Human-readable file size (e.g., "2.5 MB") |
| mode | string | Image color mode (e.g., "RGB", "CMYK") |
| created_at | datetime | Image upload timestamp |
| updated_at | datetime | Image last update timestamp |
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 |