customerCategories
Requires a customer (portal or buyer app) session.
Returns the category tree of the catalogue with a count of products under each category. Categories with no products are left out.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query CustomerCategories {
customerCategories {
id
code
name
description
imageUrl
level
children {
id
code
name
description
imageUrl
level
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query CustomerCategories {\n customerCategories {\n id\n code\n name\n description\n imageUrl\n level\n children {\n id\n code\n name\n description\n imageUrl\n level\n }\n }\n}"
}
EOF
Response:
{
"data": {
"customerCategories": [
{
"id": "id",
"code": "string",
"name": "string",
"description": "string",
"imageUrl": "string",
"level": 0,
"children": [
{
"id": "id",
"code": "string",
"name": "string",
"description": "string",
"imageUrl": "string",
"level": 0
}
]
}
]
}
}
customerCategories(
brandId: ID
): [CustomerCategory!]!
Arguments
customerCategories.brandId ● ID scalar
Count only this brand's products, so the tree lists just the categories the brand sells in.
Type
CustomerCategory object
A category a customer can shop.