Shipments average time in picking

POST https://{{subdomain}}.commercelayer.io/metrics/orders/stats

The problem

You want to get the average time (in seconds) that your order shipments (over a selected date and time range) remain in picking status.

The solution

Query

You need to perform a stats query setting the required query keys as follows:

KeyValue
fieldshipments.seconds_in_picking
operatoravg

Filter

Make sure to set the desired date and time range using the date_from and date_to keys in the filter or as your environment variables.

In this example, since we use placed_at as the date_field, you'll get in the response all the orders that were placed within the selected date and time range (read more about this).

Request Body

{"stats"=>{"field"=>"shipments.seconds_in_picking", "operator"=>"avg"}, "filter"=>{"order"=>{"date_from"=>"{{date_from}}", "date_to"=>"{{date_to}}", "date_field"=>"placed_at"}}}

HEADERS

KeyDatatypeRequiredDescription
Acceptstring
Content-Typestring