Orders by shipment status and shipping method name
How to use the Metrics API to get the total number of orders of your organization, grouped by the associated shipment status and the related shipping method name
Last updated
How to use the Metrics API to get the total number of orders of your organization, grouped by the associated shipment status and the related shipping method name
Last updated
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": "shipments.status",
"field": "order.id",
"operator": "value_count",
"limit": 10,
"breakdown": {
"by": "shipments.shipping_method.name",
"field": "order.id",
"operator": "value_count",
"limit": 5
}
},
"filter": {
"order": {
"date_from": "2021-01-01T00:00:00Z",
"date_to": "2022-11-31T23:59:00Z"
}
}
}'{
"data": {
"shipments.status": [
{
"label": "shipped",
"value": 7356,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 1234
},
{
"label": "Express Delivery",
"value": 2345
},
{
"label": "Tracked Delivery",
"value": 3456
},
{
"label": "Premium Fast Delivery",
"value": 321
}
]
},
{
"label": "picking",
"value": 8675,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 4321
},
{
"label": "Express Delivery",
"value": 3232
},
{
"label": "Tracked Delivery",
"value": 1122
}
]
},
{
"label": "cancelled",
"value": 888,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 123
},
{
"label": "Express Delivery",
"value": 321
},
{
"label": "Premium Fast Delivery",
"value": 444
}
]
},
{
"label": "packing",
"value": 7889,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 2222
},
{
"label": "Express Delivery",
"value": 4322
},
{
"label": "Tracked Delivery",
"value": 1234
},
{
"label": "Premium Fast Delivery",
"value": 111
}
]
},
{
"label": "upcoming",
"value": 3290,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 2345
},
{
"label": "Express Delivery",
"value": 433
},
{
"label": "Tracked Delivery",
"value": 500
},
{
"label": "Premium Fast Delivery",
"value": 12
}
]
},
{
"label": "on_hold",
"value": 310,
"shipments.shipping_method.name": [
{
"label": "Express Delivery",
"value": 200
},
{
"label": "Tracked Delivery",
"value": 100
},
{
"label": "Premium Fast Delivery",
"value": 10
}
]
},
{
"label": "ready_to_ship",
"value": 143,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 55
},
{
"label": "Express Delivery",
"value": 44
},
{
"label": "Tracked Delivery",
"value": 33
},
{
"label": "Premium Fast Delivery",
"value": 11
}
]
},
{
"label": "draft",
"value": 101,
"shipments.shipping_method.name": [
{
"label": "Standard Delivery",
"value": 56
},
{
"label": "Express Delivery",
"value": 45
}
]
}
]
},
"meta": {
"type": "breakdown",
"trace_id": "fe571ea2-8a4f-4a5e-bd26-ac54651bb2e4",
"mode": "test",
"organization_id": "xYZkjABcde",
"market_ids": [ "yzXKjYzaCx", "..." ]
}
}