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
| Parameter | Type | Required | Description |
|---|---|---|---|
| slug | string | Yes | URL-friendly product identifier |
Example Requests
- 🐍 Python
- 🌐 Curl
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())1# Without authentication
2curl "http://www.example.com/api/shop/products/iphone-14-pro"
3
4# With authentication
5curl "http://www.example.com/api/shop/products/iphone-14-pro" -H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Product retrieved successfully |
| 404 | Product not found |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the product |
| image | Object | Main product image data |
| code | String | Product code/SKU |
| name | 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] | Categories information (`id`, `name`, `slug`) |
| attributes | Array[Object] | Product attributes (`id`, `name`, `values`) |
| images | Array[Object] | All product images |
| description | String | Full product description |
| created_at | String (ISO 8601) | Timestamp when product was created |
| updated_at | String (ISO 8601) | Timestamp when product was last updated |
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) |
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 |