Skip to main content

Get All Brands

Retrieve a list of brands with optional filtering, searching, and pagination.

HTTP Request

GET/api/shop/brands

Authorization

Authorization

  • Required: No
  • Permission: None (public access) or Authenticated users
  • Authentication: None or Token-based authentication

Query Parameters

ParameterTypeDefaultDescription
limitIntegerNumber of results to return per page. Default is 10.
offsetIntegerNumber of results to skip before returning results. Default is 0.
searchStringSearch in `name`.
orderingStringField to order results by. Options are `id`, `order`, `name`, `created_at`, `updated_at`.
has_imageBooleanFilter brands by image presence.
has_productsBooleanFilter brands with/without products.
id_minIntegerMinimum ID filter.
id_maxIntegerMaximum ID filter.
created_dateString (YYYY-MM-DD)Filter by creation date (e.g., `2023-01-01`).
updated_dateString (YYYY-MM-DD)Filter by last updated date (e.g., `2023-01-01`).
created_fromString (YYYY-MM-DD)Filter by creation date range start.
created_toString (YYYY-MM-DD)Filter by creation date range end.
updated_fromString (YYYY-MM-DD)Filter by last updated date range start.
updated_toString (YYYY-MM-DD)Filter by last updated date range end.

Example Requests

1import requests
2
3# List all brands
4response = requests.get('http://www.example.com/api/shop/brands')
5print(response.json())
6
7# List brands with filters
8response = requests.get('http://www.example.com/api/shop/brands?has_products=true&created_from=2023-01-01&created_to=2023-12-31')
9print(response.json())
10
11# Search for brands
12
13response = requests.get('http://www.example.com/api/shop/brands?search=apple')
14print(response.json())

Status Codes

CodeDescription
200Brands retrieved successfully
400Bad request — invalid parameters
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the brand
orderIntegerDisplay order of the brand
imageObject or nullBrand image data (`id`, `url`, `name`)
nameStringBrand name
slugStringURL-friendly version of the brand name
descriptionStringBrand description
products_countIntegerNumber of products associated with this brand
created_atString (ISO 8601)Timestamp when brand was created
updated_atString (ISO 8601)Timestamp when brand was last updated

Example Response

[
{
"id": 1,
"order": 0,
"image": {
"id": 10,
"url": "/media/brands/apple.jpg",
"name": "Apple"
},
"name": "Apple",
"description": "Leading technology brand known for iPhones, iPads, and Macs.",
"products_count": 200,
"created_at": "2023-01-01T12:00:00Z",
"updated_at": "2023-01-02T12:00:00Z"
},
{
"id": 2,
"order": 1,
"image": null,
"name": "Samsung",
"description": "",
"products_count": 150,
"created_at": "2023-01-05T12:00:00Z",
"updated_at": "2023-01-06T12:00:00Z"
}
]

Notes

    • The image field may be null if no image is associated with the brand.
    • The description field may be empty if no description is available.
    • The products_count field indicates how many active products are associated with the brand.