Returns per year by destination city
How to use the Metrics API to get the total number of returns requested for your orders, grouped by year and destination city
Last updated
How to use the Metrics API to get the total number of returns requested for your orders, grouped by year and destination city
Last updated
curl -g -X POST \
'https://{{your_domain}}.commercelayer.io/metrics/returns/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": "return.current_date",
"field": "return.id",
"operator": "value_count",
"interval": "year",
"breakdown": {
"by": "destination_address.city",
"field": "return.skus_count",
"operator": "avg"
}
},
"filter": {
"return": {
"date_from": "2021-01-01T00:00:00Z",
"date_to": "2021-12-31T23:59:00Z"
}
}
}'{
"data": [
{
"date": "2021-01-01T00:00:00.000Z",
"value": 123,
"destination_address.city": [
{
"label": "London",
"value": 2.75
},
{
"label": "New York",
"value": 1.67
},
{
"label": "Los Angeles",
"value": 1.5
},
{
"label": "Paris",
"value": 1.23
},
{
"label": "Milan",
"value": 1.11
},
{ ... }
]
}
],
"meta": {
"type": "date_breakdown",
"trace_id": "fe571ea2-8a4f-4a5e-bd26-ac54651bb2e4",
"mode": "test",
"organization_id": "xYZkjABcde",
"market_ids": [ "yzXKjYzaCx", "..." ]
}
}