Get All Products
Retrieve a list of products with optional filtering, searching, and pagination.
HTTP Request
GET/api/shop/products/
NOTE: NOT USING THE TRAILING SLASH AT THE END OF THE URL RESULTS TO AN EXTRA REDIRECT WITH 301 STATUS
Authorization
Authorization
- Required: No
- Permission: Public (read-only)
- Authentication: None
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 |
| search | string | — | Search in product `title`. |
| ordering | string | — | Order results by (`id`, `title`, `created_at`, `updated_at`, `order`, `active`, `brand__id`, `brand__name`, `categories__id`, `categories__name`, `stock_type`, `stock`, `regular_price`, `sale_price`, `_price`, `_discount`, `_discount_percent`, `_in_stock`, `_rating`, `_comments_count`) |
| brand_id | integer | — | Filter by specific brand ID |
| brand_in | string | — | Filter by multiple brand IDs (comma-separated: `1,2,3`) |
| category_id | integer | — | Filter by specific category ID |
| category_in | string | — | Filter by multiple category IDs (comma-separated: `1,2,3`) |
| category_tree_id | integer | — | Filter by category tree ID (returns all products in the category and subcategories) |
| regular_price_min | number | — | Minimum regular price filter |
| regular_price_max | number | — | Maximum regular price filter |
| sale_price_min | number | — | Minimum sale price filter |
| sale_price_max | number | — | Maximum sale price filter |
| has_discount | boolean | — | Filter products with/without discount |
| discount_percent_min | number | — | Minimum discount percentage filter |
| discount_percent_max | number | — | Maximum discount percentage filter |
| discount_min | number | — | Minimum discount amount filter |
| discount_max | number | — | Maximum discount amount filter |
| price_min | number | — | Minimum final price filter |
| price_max | number | — | Maximum final price filter |
| in_stock | boolean | — | Filter by stock availability |
| has_image | boolean | — | Filter products with/without image |
| has_comments | boolean | — | Filter products with/without comments |
| comments_count_min | integer | — | Minimum comments count filter |
| comments_count_max | integer | — | Maximum comments count filter |
| rating_min | number | — | Minimum rating filter |
| rating_max | number | — | Maximum rating filter |
| 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 |
| created_to | string | — | Filter by creation date range end |
| updated_from | string | — | Filter by last updated date range start |
| updated_to | string | — | Filter by last updated date range end |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2
3# Basic product listing
4response = requests.get('http://www.example.com/api/shop/products', params={
5 'limit': 20,
6 'ordering': '_price',
7 'search': 'smartphone',
8 'category_id': 1,
9 'has_discount': True,
10 'price_min': 100,
11 'price_max': 1000,
12 'in_stock': True
13})
14print(response.json())
15
16# With authentication for favorites
17response = requests.get('http://www.example.com/api/shop/products',
18 params={'limit': 10},
19 headers={'Authorization': 'Token <your_api_key>'}
20)
21print(response.json())1# Basic listing with filters
2curl "http://www.example.com/api/shop/products?limit=20&ordering=_price&search=smartphone&category_id=1&has_discount=true&price_min=100&price_max=1000&in_stock=true"
3
4# With authentication
5curl "http://www.example.com/api/shop/products?limit=10" -H "Authorization: Token <your_api_key>"Response Fields
| Field | Type | Description |
|---|---|---|
| count | Integer | Total number of categories |
| next | String | URL for the next page of results |
| previous | String | URL for the previous page of results |
| results | Array[Object] | Array of Product objects |
Product Object Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the product |
| image | Object | Product image data (`id`, `url`, `name`, etc.) |
| code | String | Product code/SKU |
| title | String | Product name |
| slug | String | URL-friendly product identifier |
| stock_type | String | Type of stock management |
| in_stock | Boolean | Whether product is in stock |
| stock | Integer | Current stock quantity |
| regular_price | Decimal | Regular price of the product |
| sale_price | Decimal | Sale price (if on sale) |
| discount | Decimal | Discount amount |
| discount_percent | Decimal | Discount percentage |
| price | Decimal | Final calculated price |
| rating | Decimal | Average product rating |
| comments_count | Integer | Number of product comments/reviews |
| price_notes | String | Additional price information |
| excerpt | String | Short product description |
| is_favorite | Boolean | Whether product is in user's favorites (requires auth) |
| brand_data | Object | Brand information (`id`, `name`, `slug`) |
| category_data | Array[Object] | Category information (`id`, `name`, `slug`) |
Image Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the image |
| type | String | File type (e.g., image/jpeg) |
| name | String | Original file name |
| size | Integer | File size in bytes |
| human_readable_size | String | Human readable file size (e.g., 2.5 MB) |
| f | String | URL to access the image file |
| width | Integer | Image width in pixels |
| height | Integer | Image height in pixels |
| mode | String | Color mode (e.g., RGB, CMYK) |
| thumbnails | List of thumbnail objects | Imgae thumbnails |
Thumbnail Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the thumbnail (unique) |
| f | String | URL to access the thumbnail file |
| size | Integer | File size in bytes (nullable) |
Brand Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the brand |
| name | String | Name of the brand |
Categories Data Structure
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the category |
| name | String | Name of the category |
Example Response
{
"count": 11,
"next": "http://127.0.0.1:8000/api/shop/products/?limit=2&offset=2",
"previous": null,
"results": [
{
"id": 60,
"image": {
"id": 2,
"type": "image",
"name": "logitech-mx-1",
"size": 4766,
"human_readable_size": "4.65 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-1.jpg",
"width": 225,
"height": 225,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"code": "661",
"title": "Cheese",
"slug": "product-name25",
"stock_type": "limited",
"in_stock": true,
"stock": 10,
"regular_price": 1000,
"sale_price": 900,
"discount": 100,
"discount_percent": 10,
"price": 900,
"rating": 0.0,
"comments_count": 0,
"price_notes": "for each one",
"excerpt": "<p>Id earum eveniet tenetur natus pariatur dolorum minus corrupti molestias. Fuga nisi quia autem perspiciatis. Est sint hic quo atque eos et eaque. Est fugit qui alias deserunt. Voluptatem quia voluptatibus ratione. Delectus nihil nulla.</p>",
"is_favorite": false,
"brand": null,
"categories": []
},
{
"id": 59,
"image": {
"id": 3,
"type": "image",
"name": "logitech-mx-2",
"size": 3166,
"human_readable_size": "3.09 KB",
"f": "http://127.0.0.1:8000/media/core_media/2025/11/22/logitech-mx-2.jpg",
"width": 275,
"height": 183,
"mode": "RGB",
"thumbnails": [
{
"id": 213,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_64x64.jpg",
"size": 64
},
{
"id": 214,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_128x128.jpg",
"size": 128
},
{
"id": 215,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_512x512.jpg",
"size": 512
},
{
"id": 216,
"f": "http://127.0.0.1:8000/media/core_media/2026/02/02/thumbnails/test2_ecH0zVV_thumbnail_1080x1080.jpg",
"size": 1080
}
]
},
"code": "857",
"title": "Bike",
"slug": "product-name10",
"stock_type": "limited",
"in_stock": true,
"stock": 10,
"regular_price": 121999,
"sale_price": 122000,
"discount": -1,
"discount_percent": 0,
"price": 122000,
"rating": 3.5,
"comments_count": 2,
"price_notes": "for each one",
"excerpt": "<p>Doloribus a consequatur natus laboriosam mollitia et totam. Dicta sit qui aut possimus officia tempora dicta vitae ab. Delectus dolores voluptas. Voluptas incidunt sit vel sapiente enim enim perspiciatis voluptatum ab. Repellendus et provident explicabo laudantium atque quos magni. Omnis dolorum totam qui reprehenderit facere.</p>",
"is_favorite": false,
"brand": {
"id": 1,
"name": "Logitech",
"slug": "logitech"
},
"categories": [
{
"id": 1,
"name": "کالای دیجیتال",
"slug": "digital-products"
},
{
"id": 2,
"name": "ماوس",
"slug": "mouse"
}
]
}
]
}