Get All Brands
This endpoint retrieves a list of all brands in the system, along with their details.
Endpoint
- URL:
/brands - Method:
GET
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
accessToken | string | Access token for authentication. (required) |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
page | number | The page number of results you want to retrieve. Defaults to 1. |
limit | number | The number of results to retrieve per page. Defaults to 10. |
name | string | Filter brands by matching names. Supports partial matching with regex and case-insensitivity. |
isFeatured | boolean | Filter by brands that are marked as featured (true) or not featured (false). |
isShow | boolean | Filter by brands that are marked as visible (true) or not visible (false). |
isShowNavBar | boolean | Filter by brands that are shown in navigation bar (true) or not (false). |
id | string | Filter brands with a specific ID. |
id:in | string | Filter brands by matching any of the provided IDs. Accepts a comma-separated list. |
date_created:min | date | Filter brands created on or after the specified date (inclusive). |
date_created:max | date | Filter brands created on or before the specified date (inclusive). |
date_modified:min | date | Filter brands last updated on or after the specified date (inclusive). |
date_modified:max | date | Filter brands last updated on or before the specified date (inclusive). |
Notes
- Date Format: When using date filters, ensure the dates are in an internationally recognized format such as ISO 8601 (
YYYY-MM-DD,YYYY-MM-DDTHH:MM:SSZ). - Logical Operators in Filters: Some parameters like
id:inallow you to specify multiple values. The API will match any of the provided values.
Sample Request
curl --location '<BASE-URL>/brands' \
--header 'accessToken: <ACCESS-TOKEN>'
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"data": [
{
"id": "brand_id",
"name": "Brand Name",
"url": "brand-url",
"description": "Brand description",
"image": "image_url",
"productCount": 10,
"sortOrder": 0,
"isFeatured": false,
"isShow": true,
"isShowNavBar": false,
"seo": {
"pageTitle": "Brand Page Title",
"metaKeywords": "keywords",
"metaDescription": "description"
},
"metaFields": [],
"createdAt": "2024-05-07T11:13:02.066Z",
"updatedAt": "2024-10-09T13:05:59.036Z"
}
// Additional brand entries
],
"pagination": {
"page": 1,
"total": 100,
"count": 10
}
}
Response Structure
General Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates whether the request was successful. |
data | array | Array of brand objects matching the filter criteria. |
pagination | object | Contains pagination information (page, total, and count) |
Brand Object
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier for the brand. |
name | string | The name of the brand. |
url | string | URL-friendly slug for the brand. |
description | string | A brief description of the brand. |
image | string | URL to the brand's main image. |
productCount | number | Number of products associated with this brand. |
sortOrder | number | Order for sorting brands. Lower numbers appear first. |
isFeatured | boolean | Whether the brand is marked as featured. |
isShow | boolean | Whether the brand is visible. |
isShowNavBar | boolean | Whether the brand appears in the navigation bar. |
seo | object | SEO metadata for the brand page. |
metaFields | array | Custom metadata fields associated with the brand. |
createdAt | date | Timestamp when the brand was created. |
updatedAt | date | Timestamp when the brand was last updated. |
SEO Object
| Field | Type | Description |
|---|---|---|
pageTitle | string | Title for the brand page. |
metaKeywords | string | Meta keywords for SEO. |
metaDescription | string | Meta description for SEO. |
Pagination Object
| Field | Type | Description |
|---|---|---|
page | number | Current page number. |
total | number | Total number of brands matching filter. |
count | number | Number of brands returned on this page. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Provided data is invalid or malformed. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- The
productCountfield is automatically maintained by the system. - Images are automatically processed and stored if provided as base64 encoded data.
- All operations automatically sync with Elasticsearch for search functionality.