Orders by day
How to use the Metrics API to get the total number of orders of your organization, grouped by day
Last updated
curl -g -X POST \
'https://{{your_domain}}.commercelayer.io/metrics/orders/date_breakdown' \
-H 'Accept: application/vnd.api.v1+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer {{your_access_token}}' \
-d '{
"date_breakdown": {
"by": "order.current_date",
"field": "order.id",
"operator": "value_count",
"interval": "day"
},
"filter": {
"order": {
"date_from": "2021-01-01T00:00:00Z",
"date_to": "2021-12-31T23:59:00Z"
}
}
}'{
"data": [
{
"date": "2021-01-01T00:00:00.000Z",
"value": 1196
},
{
"date": "2021-01-02T00:00:00.000Z",
"value": 1371
},
{
"date": "2021-01-03T00:00:00.000Z",
"value": 1574
},
{
"date": "2021-01-04T00:00:00.000Z",
"value": 1735
},
{ ... },
{
"date": "2021-12-30T00:00:00.000Z",
"value": 2344
},
{
"date": "2021-12-31T00:00:00.000Z",
"value": 1905
}
],
"meta": {
"type": "date_breakdown",
"trace_id": "fe571ea2-8a4f-4a5e-bd26-ac54651bb2e4",
"mode": "test",
"organization_id": "xYZkjABcde",
"market_ids": [ "yzXKjYzaCx", "..." ]
}
}