Orders by bundle
How to use the Metrics API to get the total number of orders containing a bundle, grouped by the bundle name
The problem
The solution
Query
Key
Value
Filter
Example
curl -g -X POST \
'https://{{your_domain}}.commercelayer.io/metrics/orders/breakdown' \
-H 'Accept: application/vnd.api.v1+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer {{your_access_token}}' \
-d '{
"breakdown": {
"by": "line_items.name",
"field": "order.id",
"operator": "value_count",
"limit": 20,
"sort": "desc"
},
"filter": {
"order": {
"date_from": "2021-01-01T00:00:00Z",
"date_to": "2021-12-31T23:59:00Z"
},
"line_items": {
"types": {
"in": [ "bundles" ]
}
}
}
}'Similar cases
Last updated