carts
Query stats on carts
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/carts/stats
Request
- Base URLhttps://{your-domain}.commercelayer.io/metrics
- URLhttps://{your-domain}.commercelayer.io/metrics/carts/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
]
},
"created_at": {
"gt_lt": [
"2022-07-06T21:41:03Z"
]
},
"discount_amount": {
"gt_lt": [
121
]
},
"duty_amount": {
"gt_lt": [
121
]
},
"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
]
},
"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"
]
}
},
"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 carts
Changes
No recorded changes to this operation across all 1 revision of this API.