Skip to main content

Get All Products

Retrieve a list of products with optional filtering, searching, and pagination.

HTTP Request

GET/api/shop/products

Authorization

Authorization

  • Required: No
  • Permission: Public (read-only)
  • Authentication: None

Query Parameters

ParameterTypeDefaultDescription
limitintegerNumber of results to return per page
offsetintegerNumber of results to skip before returning results
searchstringSearch in product `name`.
orderingstringField to order results by (`id`, `name`, `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_idintegerFilter by specific brand ID
brand_instringFilter by multiple brand IDs (comma-separated: `1,2,3`)
category_idintegerFilter by specific category ID
category_instringFilter by multiple category IDs (comma-separated: `1,2,3`)
category_tree_idintegerFilter by category tree ID (returns all products in the category and subcategories)
regular_price_minnumberMinimum regular price filter
regular_price_maxnumberMaximum regular price filter
sale_price_minnumberMinimum sale price filter
sale_price_maxnumberMaximum sale price filter
price_minnumberMinimum final price filter
price_maxnumberMaximum final price filter
has_discountbooleanFilter products with/without discount
discount_minnumberMinimum discount amount filter
discount_maxnumberMaximum discount amount filter
discount_percent_minnumberMinimum discount percentage filter
discount_percent_maxnumberMaximum discount percentage filter
in_stockbooleanFilter by stock availability
has_imagebooleanFilter products with/without image
has_commentsbooleanFilter products with/without comments
comments_count_minintegerMinimum comments count filter
comments_count_maxintegerMaximum comments count filter
rating_minnumberMinimum rating filter
rating_maxnumberMaximum rating filter
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
created_tostringFilter by creation date range end
updated_fromstringFilter by last updated date range start
updated_tostringFilter by last updated date range end

Example Requests

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

Status Codes

CodeDescription
200Products retrieved successfully
400Bad request — invalid query parameters
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product
imageObjectProduct image data (`id`, `url`, `name`, etc.)
codeStringProduct code/SKU
nameStringProduct name
slugStringURL-friendly product identifier
stock_typeStringType of stock management
in_stockBooleanWhether product is in stock
stockIntegerCurrent stock quantity
regular_priceDecimalRegular price of the product
sale_priceDecimalSale price (if on sale)
discountDecimalDiscount amount
discount_percentDecimalDiscount percentage
priceDecimalFinal calculated price
ratingDecimalAverage product rating
comments_countIntegerNumber of product comments/reviews
price_notesStringAdditional price information
excerptStringShort product description
is_favoriteBooleanWhether product is in user's favorites (requires auth)
brand_dataObjectBrand information (`id`, `name`, `slug`)
category_dataArray[Object]Category information (`id`, `name`, `slug`)

Image Data Structure

FieldTypeDescription
idIntegerUnique ID of the image
typeStringFile type (e.g., image/jpeg)
nameStringOriginal file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size (e.g., 2.5 MB)
fStringURL to access the image file
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringColor mode (e.g., RGB, CMYK)

Brand Data Structure

FieldTypeDescription
idIntegerUnique ID of the brand
nameStringName of the brand

Categories Data Structure

FieldTypeDescription
idIntegerUnique ID of the category
nameStringName of the category