productAttributeUsage
Requires permission products:product:read.
How many products and variants carry an attribute (or one value of it), and which product finders name it. Requires permission to read products.
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 ProductAttributeUsage($attributeKey: String!) {
productAttributeUsage(attributeKey: $attributeKey) {
finders
productCount
variantCount
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ProductAttributeUsage($attributeKey: String!) {\n productAttributeUsage(attributeKey: $attributeKey) {\n finders\n productCount\n variantCount\n }\n}",
"variables": {
"attributeKey": "string"
}
}
EOF
Variables:
{
"attributeKey": "string"
}
Response:
{
"data": {
"productAttributeUsage": {
"finders": [
"string"
],
"productCount": 0,
"variantCount": 0
}
}
}
productAttributeUsage(
attributeKey: String!
value: String
): ProductAttributeUsage!
Arguments
productAttributeUsage.attributeKey ● String! non-null scalar
The attribute, in any spelling.
productAttributeUsage.value ● String scalar
One value of it; absent asks about the whole attribute.
Type
ProductAttributeUsage object
Where an attribute, or one value of it, is used.