Retrieve Brand by Slug
Retrieve a specific brand by its unique slug.
HTTP Request
GET/api/shop/brands/:slug
Authorization
Authorization
- Required: No
- Permission: None (public access) or Authenticated users
- Authentication: None or Token-based authentication
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| slug | String | Yes | URL-friendly version of the brand name |
Example Requests
- 🐍 Python
- 🌐 Curl
1import requests
2response = requests.get('http://www.example.com/api/shop/brands/apple/')
3print(response.json())1curl -X GET "http://www.example.com/api/shop/brands/apple/" -H "Authorization: Token <your_api_key>"Status Codes
| Code | Description |
|---|---|
| 200 | Brand retrieved successfully |
| 400 | Bad request — invalid parameters |
| 404 | Not found — brand does not exist |
| 500 | Internal server error |
Response Fields
| Field | Type | Description |
|---|---|---|
| id | Integer | Unique ID of the brand |
| order | Integer | Display order of the brand |
| image | Object or null | Brand image data (`id`, `url`, `name`) |
| name | String | Brand name |
| slug | String | URL-friendly version of the brand name |
| description | String | Brand description |
| products_count | Integer | Number of products associated with this brand |
| created_at | String (ISO 8601) | Timestamp when brand was created |
| updated_at | String (ISO 8601) | Timestamp when brand was last updated |
Example Response
{
"id": 1,
"order": 1,
"image": {
"id": 10,
"url": "http://www.example.com/media/brands/apple.png",
"name": "apple.png"
},
"name": "Apple",
"slug": "apple",
"description": "Leading technology company known for iPhones and MacBooks.",
"products_count": 150,
"created_at": "2023-01-15T10:00:00Z",
"updated_at": "2023-06-20T12:30:00Z"
}
Notes
- The
imagefield may be null if no image is associated with the brand. - The
descriptionfield may be empty if no description is available. - The
products_countfield indicates how many active products are associated with the brand.