API documentation for working with brands
Table with field descriptions
| Field | Type | Required? | Description |
|---|---|---|---|
id| int |
No | Unique brand identifier (required when updating). | |
name| string |
Yes | Brand name. | |
description| string |
No | Brand description. | |
image| file |
No | Brand image (maximum 250 KB). | |
slug| string |
Yes | Unique URL-friendly brand identifier. | |
hide| boolean |
No | Is the brand hidden? The default value is True. |
|
order| int |
No | The ordinal value of the brand for sorting. | |
link| string |
No | Brand website (URL). | |
seo_title| string |
No | SEO title. | |
seo_keywords| string |
No | SEO keywords. | |
seo_description| string |
No | SEO description. | |
is_featured| boolean |
No | Whether the brand is marked as a favorite. The default value is False. |
Endpoints
1. Getting all brands
Description : Returns a list of all brands on the site. Supports filtering by last update time.
Endpoint :
[GET] /external/brand/
Answer :
[ { "id": 1, "name": "Brand Name", "description": "Brand description text", "image": "https://example.com/image.jpg", "slug": "brand-name", "hide": false, "order": 1, "link": "https://brand-website.com", "seotitle": "Brand SEO Title", "seokeywords": "keyword1, keyword2", "seodescription": "Brand SEO description", "isfeatured": true } ]
2. Getting one brand
Description : Returns information about a single brand by ID.
Endpoint :
[GET] /external/brand/{id}/
URL Parameters :
id(int) : Unique brand identifier.
Answer :
{ "id": 1, "name": "Brand Name", "description": "Brand description text", "image": "https://example.com/image.jpg", "slug": "brand-name", "hide": false, "order": 1, "link": "https://brand-website.com", "seotitle": "Brand SEO Title", "seokeywords": "keyword1, keyword2", "seodescription": "Brand SEO description", "isfeatured": true }
3. One brand update
Description : Allows you to update data for one brand.
Endpoint :
[PUT] /external/brand/{id}/
Example request :
{ "name": "Updated Brand Name", "slug": "updated-brand-name", "description": "Updated description", "order": 2, "is_featured": true }
Answer :
{ "id": 1, "name": "Updated Brand Name", "slug": "updated-brand-name", "description": "Updated description", "order": 2, "is_featured": true }
4. Massive brand update
Description: Allows you to update several brands at the same time.
Endpoint :
[PUT] /external/brand/bulk-update/
Example request :
[ { "id": 1, "name": "Updated Brand 1", "order": 1, "isfeatured": true }, { "id": 2, "name": "Updated Brand 2", "order": 2, "isfeatured": false } ]
Answer :
[ { "id": 1, "name": "Updated Brand 1", "order": 1, "isfeatured": true }, { "id": 2, "name": "Updated Brand 2", "order": 2, "isfeatured": false } ]
5. Mass brand creation
Description: Allows you to create multiple brands in one request.
Endpoint :
[POST] /external/brand/bulk-create/
Example request :
[ { "name": "New Brand 1", "slug": "new-brand-1", "description": "Description for brand 1", "order": 1, "isfeatured": false, "hide": false }, { "name": "New Brand 2", "slug": "new-brand-2", "description": "Description for brand 2", "order": 2, "isfeatured": true, "hide": false } ]
Answer :
[ { "id": 1, "name": "New Brand 1", "slug": "new-brand-1", "description": "Description for brand 1", "order": 1, "isfeatured": false, "hide": false, "image": null, "link": null, "seotitle": null, "seokeywords": null, "seodescription": null }, { "id": 2, "name": "New Brand 2", "slug": "new-brand-2", "description": "Description for brand 2", "order": 2, "isfeatured": true, "hide": false, "image": null, "link": null, "seotitle": null, "seokeywords": null, "seodescription": null } ]
Error handling
Both the bulk-update and bulk-create endpoints handle the following errors:
- Integrity Error (slug already exists) : Returns an error message if the specified
slugis already in use by another brand on this system. - Invalid data : Returned if the passed data is invalid.
- Not found (only for bulk-update) : Returned if the specified brand ID is not found in the system.
Was the article helpful?
Yes, thank you! Unfortunately no