Skip to main content

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

HeaderTypeDescription
accessTokenstringAccess token for authentication. (required)

Query Parameters

ParameterTypeDescription
pagenumberThe page number of results you want to retrieve. Defaults to 1.
limitnumberThe number of results to retrieve per page. Defaults to 10.
namestringFilter brands by matching names. Supports partial matching with regex and case-insensitivity.
isFeaturedbooleanFilter by brands that are marked as featured (true) or not featured (false).
isShowbooleanFilter by brands that are marked as visible (true) or not visible (false).
isShowNavBarbooleanFilter by brands that are shown in navigation bar (true) or not (false).
idstringFilter brands with a specific ID.
id:instringFilter brands by matching any of the provided IDs. Accepts a comma-separated list.
date_created:mindateFilter brands created on or after the specified date (inclusive).
date_created:maxdateFilter brands created on or before the specified date (inclusive).
date_modified:mindateFilter brands last updated on or after the specified date (inclusive).
date_modified:maxdateFilter 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:in allow 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

FieldTypeDescription
successbooleanIndicates whether the request was successful.
dataarrayArray of brand objects matching the filter criteria.
paginationobjectContains pagination information (page, total, and count)

Brand Object

FieldTypeDescription
idstringUnique identifier for the brand.
namestringThe name of the brand.
urlstringURL-friendly slug for the brand.
descriptionstringA brief description of the brand.
imagestringURL to the brand's main image.
productCountnumberNumber of products associated with this brand.
sortOrdernumberOrder for sorting brands. Lower numbers appear first.
isFeaturedbooleanWhether the brand is marked as featured.
isShowbooleanWhether the brand is visible.
isShowNavBarbooleanWhether the brand appears in the navigation bar.
seoobjectSEO metadata for the brand page.
metaFieldsarrayCustom metadata fields associated with the brand.
createdAtdateTimestamp when the brand was created.
updatedAtdateTimestamp when the brand was last updated.

SEO Object

FieldTypeDescription
pageTitlestringTitle for the brand page.
metaKeywordsstringMeta keywords for SEO.
metaDescriptionstringMeta description for SEO.

Pagination Object

FieldTypeDescription
pagenumberCurrent page number.
totalnumberTotal number of brands matching filter.
countnumberNumber of brands returned on this page.

Error Responses

Status CodeDescription
400Bad Request: Provided data is invalid or malformed.
401Unauthorized: Access token is invalid or missing.
500Internal Server Error: An error occurred on the server.

Notes

  • The productCount field 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.