Skip to main content

Retrieve a Product

Retrieves detailed information about a specific product by its slug.

HTTP Request

GET/api/shop/products/:slug

Authorization

Authorization

  • Required: No
  • Permission: Public (read-only)
  • Authentication: Optional (affects `is_favorite` field)

Path Parameters

ParameterTypeRequiredDescription
slugstringYesURL-friendly product identifier

Example Requests

1import requests
2
3# Without authentication
4response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro')
5print(response.json())
6
7# With authentication for favorites
8response = requests.get('http://www.example.com/api/shop/products/iphone-14-pro', headers={
9  'Authorization': 'Token <your_api_key>'
10})
11print(response.json())

Status Codes

CodeDescription
200Product retrieved successfully
404Product not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the product
imageObjectMain product image data
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]Categories information (`id`, `name`, `slug`)
attributesArray[Object]Product attributes (`id`, `name`, `values`)
imagesArray[Object]All product images
descriptionStringFull product description
created_atString (ISO 8601)Timestamp when product was created
updated_atString (ISO 8601)Timestamp when product was last updated

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