Queries
brand
An active brand by its slug, with its products in the same query.
brand returns an active brand from the slug in its URL. Its products field returns the brand's products, with filters and facets, in the same query.
brand(slug: String!): BrandDetail!Arguments
| Argument | Type | Rule |
|---|---|---|
slug | String! | Up to 200 characters. Surrounding spaces are trimmed. |
BrandDetail
| Field | Type | Description |
|---|---|---|
id | String! | Brand ID. |
name | String! | Name. |
slug | String! | Slug. |
url | String! | Public path of the brand. |
imageUrl | String | The brand's logo, or its icon when it has no logo. |
description | String | Description. |
metaTitle | String | Title for search engines. |
metaDescription | String | Description for search engines. |
productCount | Int! | Published products with this brand. |
products(input: StorefrontProductsInput) | SearchResult! | The brand's products. |
products takes the same input as products and returns the same SearchResult. It filters by the brand name: it replaces whatever you send in brands.
Example
query BrandPage($slug: String!, $page: Int = 1) {
brand(slug: $slug) {
id
name
url
imageUrl
description
products(input: { page: $page, pageSize: 24, includeFilters: false }) {
totalPages
products { id name url imageUrl price }
}
}
}curl --request POST "https://storefront.ecomiq.pe/graphql" \
--header "Content-Type: application/json" \
--header "x-Store-Domain: my-store" \
--data-binary '{
"query": "query BrandPage($slug: String!, $page: Int = 1) { brand(slug: $slug) { id name url imageUrl description products(input: { page: $page, pageSize: 24, includeFilters: false }) { totalPages products { id name url imageUrl price } } } }",
"variables": { "slug": "andina", "page": 1 }
}'{
"data": {
"brand": {
"id": "7204558912004324355",
"name": "Andina",
"url": "/brands/andina",
"imageUrl": "https://…/andina.webp",
"description": "Pima cotton clothing.",
"products": {
"totalPages": 1,
"products": [
{
"id": "7204558912004322039",
"name": "Pima cotton T-shirt",
"url": "/products/pima-cotton-t-shirt",
"imageUrl": "https://…/t-shirt.webp",
"price": 59.9
}
]
}
}
}
}Errors
| Code | Cause |
|---|---|
BAD_USER_INPUT | slug is empty or longer than 200 characters, or input is not valid. |
NOT_FOUND | The brand doesn't exist in the store or is inactive. |
STORE_CONTEXT_REQUIRED | x-Store-Domain is missing or doesn't match a store. |
REST equivalent
GET / returns the same brand, without products. For its products, filter GET / with its name in brands.
Last updated: