Skip to main content

Create Brand

Creates a new brand with the specified properties.

HTTP Request

POST/api/products/brands

Authorization

Authorization

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

Request Body

FieldTypeRequiredDescription
nameStringYesBrand name (must be unique)
slugStringNoURL-friendly version of the brand name (auto-generated if not provided)
imageIntegerNoID of the brand image
orderIntegerNoDisplay order for brand sorting
descriptionStringNoBrand description (max 500 characters)

Example Requests

1import requests
2
3# Create a new brand
4response = requests.post('http://www.example.com/api/products/brands', 
5  json={
6      'name': 'Nike',
7      'image': 123,
8      'order': 1,
9      'description': 'Just Do It - Global athletic footwear and apparel company'
10  },
11  headers={'Authorization': 'Token <your_api_key>'}
12)
13print(response.json())
14
15# Create minimal brand
16response = requests.post('http://www.example.com/api/products/brands', 
17  json={
18      'name': 'Adidas'
19  },
20  headers={'Authorization': 'Token <your_api_key>'}
21)
22print(response.json())

Status Codes

CodeDescription
201Brand created successfully
400Bad request — invalid input or duplicate name
401Unauthorized — authentication required
403Forbidden — insufficient permissions
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the brand
image_dataObjectBrand image details (read-only)
orderIntegerDisplay order for brand sorting
nameStringBrand name (unique)
slugStringURL-friendly version of the brand name
descriptionStringBrand description (max 500 characters)
products_countIntegerNumber of products associated with brand
created_atString (ISO 8601)Timestamp when brand was created
updated_atString (ISO 8601)Timestamp when brand was last updated

Image Data Structure

FieldTypeDescription
idIntegerImage ID
typeStringFile type
nameStringImage file name
sizeIntegerFile size in bytes
human_readable_sizeStringHuman readable file size
fStringImage file URL
widthIntegerImage width in pixels
heightIntegerImage height in pixels
modeStringImage color mode