Skip to main content

Retrieve Product

Retrieve a specific product by its unique ID.

HTTP Request

GET/api/products/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the product to retrieve

Example Requests

1import requests
2
3response = requests.get('http://www.example.com/api/products/123', 
4  headers={'Authorization': 'Token <your_api_key>'}
5)
6print(response.json())

Status Codes

CodeDescription
200Products retrieved successfully
400Bad request — invalid parameters
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Not found — product does not exist
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product
activeBooleanWhether the product is active
image_dataObjectImage details (read-only)
orderIntegerDisplay order priority
codeStringProduct code/SKU
nameStringProduct name
slugStringURL-friendly product identifier
stock_typeStringStock management type
stockIntegerAvailable stock quantity
in_stockBooleanWhether the product is in stock (computed)
regular_priceDecimalOriginal price of the product
sale_priceDecimalSale price (if on sale)
discountDecimalDiscount amount (computed)
discount_percentDecimalDiscount percentage (computed)
priceDecimalFinal price after discount (computed)
price_notesStringAdditional pricing notes
excerptStringShort product description
comments_countIntegerNumber of comments (computed)
ratingDecimalAverage product rating (computed)
descriptionStringFull product description
created_atString (ISO 8601)Timestamp when product was created
updated_atString (ISO 8601)Timestamp when product was last updated
brand_dataObjectBrand details (id: int, name: string)
categories_dataArray[Object]List of categories the product belongs to (id: int, name: string)

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

Notes

  • Fields marked as "computed" are generated by the system and cannot be set directly.
  • Date fields are in ISO 8601 format (e.g., "2023-01-01T12:00:00Z").