Stats

A comprehensive list of the stats query keys, allowed fields values, and operators for the return resource

To perform a stats query on the return resource send a POST request to the /returns/stats endpoint specifying in the payload the query keys and filter parameters like in the generic example below:

{
  "stats": {
    "field": "...",
    "operator": "..."
  },
  "filter": { ... }
}

Please find more information on how stats queries work here.

Query keys

These are the keys you need to set when performing a stats query:

Key
Type
Required
Description
Values

field

String

The field you want the metrics or statistics computed on.

See the table below to check the full list of valid values for this key.

operator

String

The computing operator.

See the table below to check the full list of valid operators based on the value you assigned to the field key.

Operators and field values

These are the valid values you can specify for the field key of the stats query and the related valid operators, based on that key:

Value
Operators

customer.id

value_count

customer.email

value_count

customer.group_name

value_count

destination_address.business

value_count

destination_address.city

value_count

destination_address.country_code

value_count

destination_address.geocoded

value_count

destination_address.localized

value_count

destination_address.state_code

value_count

destination_address.zip_code

value_count

origin_address.business

value_count

origin_address.city

value_count

origin_address.country_code

value_count

origin_address.geocoded

value_count

origin_address.localized

value_count

origin_address.state_code

value_count

origin_address.zip_code

value_count

market.id

cardinality

value_count

market.number

cardinality

value_count

return.number

value_count

return.reference

value_count

return.reference_origin

value_count

return.status

value_count

return.id

cardinality

value_count

return.order_id

value_count

return.skus_count

avg

max

min

sum

stats

return_line_items.quantity

avg

max

min

sum

stats

return_line_items.line_item_id

value_count

return_line_items.line_item_code

value_count

return_line_items.line_item_item_type

value_count

return_line_items.line_item_total_amount

avg

max

min

sum

stats

return_line_items.line_item_tax_amount

avg

max

min

sum

stats

return_line_items.line_item_tax_rate

avg

max

min

sum

stats

stock_location.id

value_count

stock_location.name

value_count

stock_location.reference

value_count

stock_location.reference_origin

value_count

Last updated