orders
Query stats on orders
Stats are aggregations that summarize your data within an operator (depending of the field, some of them could not be available), such as: value_count, cardinality, avg, min, max, sum or stats (which returns avg, min, max, sum) computed on the field specificed. When performing a stats 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.
Stats request
{ "stats": { "field": "order.total_amount_cents", "operator": "stats" } }
post/orders/stats
Request
- Base URLhttps://{your-domain}.commercelayer.io/metrics
- URLhttps://{your-domain}.commercelayer.io/metrics/orders/stats
- AuthHTTP bearer
Request body
Example request
{
"filter": {
"line_items": {
"discount": {
"gt_lt": [
121
]
},
"options_amount": {
"gt_lt": [
121
]
},
"quantity": {
"gt_lt": [
8
]
},
"tax_amount": {
"gt_lt": [
121
]
},
"tax_rate": {
"gt_lt": [
121
]
},
"total_amount": {
"gt_lt": [
121
]
},
"unit_amount": {
"gt_lt": [
121
]
},
"updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
}
},
"line_items.options": {
"quantity": {
"gt_lt": [
8
]
},
"total_amount": {
"gt_lt": [
121
]
},
"unit_amount": {
"gt_lt": [
121
]
}
},
"market": {
"numbers": {
"in": [
8
]
}
},
"order": {
"date_from": "2022-07-06T21:41:03Z",
"date_to": "2022-07-06T21:41:03Z",
"adjustment_amount": {
"gt_lt": [
121
]
},
"adjustment_tax_amount": {
"gt_lt": [
121
]
},
"adjustment_taxable_amount": {
"gt_lt": [
121
]
},
"approved_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"archived_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"cancelled_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"created_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"discount_amount": {
"gt_lt": [
121
]
},
"duty_amount": {
"gt_lt": [
121
]
},
"fulfillment_updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"gift_card_amount": {
"gt_lt": [
121
]
},
"line_item_options_count": {
"gt_lt": [
8
]
},
"numbers": {
"in": [
8
]
},
"payment_method_amount": {
"gt_lt": [
121
]
},
"payment_method_tax_amount": {
"gt_lt": [
121
]
},
"payment_method_taxable_amount": {
"gt_lt": [
121
]
},
"payment_updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"placed_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"shipments_count": {
"gt_lt": [
8
]
},
"shipping_amount": {
"gt_lt": [
121
]
},
"shipping_taxable_amount": {
"gt_lt": [
121
]
},
"skus_count": {
"gt_lt": [
8
]
},
"subtotal_amount": {
"gt_lt": [
121
]
},
"subtotal_tax_amount": {
"gt_lt": [
121
]
},
"subtotal_taxable_amount": {
"gt_lt": [
121
]
},
"total_amount": {
"gt_lt": [
121
]
},
"total_amount_with_taxes": {
"gt_lt": [
121
]
},
"total_tax_amount": {
"gt_lt": [
121
]
},
"total_taxable_amount": {
"gt_lt": [
121
]
},
"updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"current_date": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"seconds_in_draft": {
"gt_lt": [
8
]
},
"seconds_in_approved": {
"gt_lt": [
8
]
},
"seconds_in_placed": {
"gt_lt": [
8
]
},
"placed_day_of_week": {
"gt_lt": [
8
]
},
"refunds_total_amount_with_taxes": {
"gt_lt": [
8
]
},
"total_amount_with_taxes_net_of_refunds": {
"gt_lt": [
121
]
}
},
"refunds": {
"amount": {
"gt_lt": [
121
]
}
},
"shipments": {
"items_count": {
"gt_lt": [
8
]
},
"cost_amount": {
"gt_lt": [
8
]
},
"cancelled_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"delivered_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"on_hold_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"picking_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"packing_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"ready_to_ship_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"shipped_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"created_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"seconds_in_picking": {
"gt_lt": [
8
]
},
"seconds_in_ready_to_ship": {
"gt_lt": [
8
]
},
"seconds_in_shipped": {
"gt_lt": [
8
]
},
"fulfillment_time": {
"gt_lt": [
8
]
}
},
"resource_errors": {
"created_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"updated_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
}
}
}
}Response
The stats result from orders
Changes
No recorded changes to this operation across all 1 revision of this API.