v1
latestOpenAPI 3.0.12026-07-1318302.2 MBQuery breakdown on orders
Breakdowns are aggregations that summarize your data as metrics (based on specific operators) or statistics, computed on field values. When performing a breakdown query on the Metrics API endpoint you get in the response the value of the computation (based on the selected operator) on the selected field, aggregated by another field.
Nesting breakdowns
Breakdowns can be nested recursively one into the other, up to one level (see example). The valid values allowed for the by key of the nested breakdown are strictly dependent on the value you specified in the by key of the parent breakdown. Hence, they are different for each resource you’re doing statistics on (see orders, returns, and carts for the related lists).You cannot group the nested breakdown by the same field by which you’re already grouping the parent breakdown.
Single breakdown request
{ "breakdown": { "by": "market.name", "field": "order.id", "operator": "value_count", "condition": { "gte_lte": [ 10000, 100000 ] }, "sort": "desc", "limit": 2 } }
Nested breakdown request
{ "breakdown": { "by": "market.name", "field": "order.id", "operator": "value_count", "condition": { "gte_lte": [ 10000, 100000 ] }, "sort": "desc", "limit": 3, "breakdown": { "by": "order.currency_code", "field": "order.total_amount_with_taxes", "operator": "sum" "sort": "desc", "limit": 2 } } }
Response
The breakdown result from orders