Date breakdown

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

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

{
  "date_breakdown": {
    "by": "...",
    "field": "...",
    "operator": "...",
    "interval": "...",
    "breakdown": {
      "by": "...",
      "field": "...",
      "operator": "...",
      "condition": { ... },
      "sort": "...",
      "limit": ...,
      "breakdown": {
        "by": "...",
        "field": "...",
        "operator": "...",
        "condition": { ... },
        "sort": "...",
        "limit": ...
      }
    }
  },
  "filter": { ... }
}

Please find more information on how date breakdown queries work here.

Query keys

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

KeyTypeRequiredDescriptionValues

by

String

The date field you want the results of the query aggragated by.

field

String

The field you want the metrics or statistics computed on.

operator

String

The computing operator.

interval

String

The time interval over which the metrics / stats are computed. The results will be aggregated by date accordingly.

One of hour, day, week, month, or year (default is month).

breakdown

Object

The optional breakdown (eventually nested).

by values

These are the valid values you can specify for the by key of the date breakdown query:

ValueDescription

return.approved_at

return.archived_at

return.cancelled_at

return.created_at

return.received_at

return.rejected_at

return.shipped_at

return.updated_at

return.current_date

Operators and field values

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

ValueOperators

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