get_orders_history

To get the history of orders, use the order/get_orders_history method.

To use the method, you need the Request reports and messages access right to the resource.

Endpoint

Copied!
svc=order/get_orders_history&params={
	"itemId":<long>,
	"ivalType":<int>,
	"ivalFrom":<uint>,
	"ivalTo":<uint>,
	"name":"<text>",
	"unitId":<long>,
	"orderId":<long>,
	"orderUid":<long>,
	"routeId":<long>
}

Parameters

The required parameters are marked with an asterisk (*).

Parameter Default value Description
itemId* Resource ID.
ivalType 1 Interval selection method. The values are the same as for the ivalType parameter of events/load, with ivalFrom and ivalTo used instead of timeFrom and timeTo.
ivalFrom 0 Depends on ivalType: interval start (UNIX time) or the number of orders to load.
ivalTo UINT_MAX Interval end (UNIX time).
name Order name masks separated by commas. An order is returned if its name matches at least one mask. Use * for any number of characters, ? for exactly one character, and ! at the beginning of a mask to invert it. For example, "Vil*,Berl*" returns the orders whose names start with Vil or Berl, "*kr" returns the orders whose names end with kr, and "!Vil*" returns the orders whose names don’t start with Vil.
unitId Unit ID.
orderId Order ID. The same ID can occur several times in the history.
orderUid Unique order ID.
routeId Unique route ID (the uid property of the route).

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
{
	"orders":[
		{...},
		{...},
		...
	],
	"count":<uint>,		/* number of the filtered orders (size of "orders") */
	"total":<uint>		/* total number of orders for the requested period */
}

If the request fails, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters.
6 Failed to load the history, for example, because the ivalType value is invalid.
7 The resource doesn’t exist, or the user doesn’t have the Request reports and messages access right to it.

If you find a mistake in the text, please select it and press Ctrl+Enter.