trendsAnalytics
Requires permission analytics:sales:read.
Trend analytics for a period. Limited to the customers you may see.. Needs the sales analytics read permission.
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 TrendsAnalytics($period: AnalyticsPeriod!) {
trendsAnalytics(period: $period) {
categoryTrends {
categoryName
categoryId
growthRate
trend
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query TrendsAnalytics($period: AnalyticsPeriod!) {\n trendsAnalytics(period: $period) {\n categoryTrends {\n categoryName\n categoryId\n growthRate\n trend\n }\n }\n}",
"variables": {
"period": "LAST_6_MONTHS"
}
}
EOF
Variables:
{
"period": "LAST_6_MONTHS"
}
Response:
{
"data": {
"trendsAnalytics": {
"categoryTrends": [
{
"categoryName": "string",
"categoryId": "string",
"growthRate": 0,
"trend": "string"
}
]
}
}
}
trendsAnalytics(
period: AnalyticsPeriod!
): TrendsAnalytics!
Arguments
trendsAnalytics.period ● AnalyticsPeriod! non-null enum
The reporting period to analyse.
Type
TrendsAnalytics object
Trends in sales.