route_update

To create, edit, or delete a route, or to move it to history, use the order/route_update method.

Endpoint

Copied!
svc=order/route_update&params={
  "itemId": <long>,
  "orders": [],
  "routeId": <long>,
  "callMode": "<text>"
}

Parameters

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

Parameter Description
itemId* Resource ID.
orders Array of JSON orders and a callMode for each order. Required if callMode is create or update.
routeId* Unique ID of the route (uid in the route data). Instead of routeId, you can specify uid with the same value or id with the route ID.
callMode* Action: create, update, delete, register, purge.

With delete, the method deletes only the route. Its orders stay in the resource unless you pass them in orders with "callMode": "delete".

With register, the method moves the route and its orders to history. To get them from history, use order/get_routes_history and order/get_orders_history.

With purge, the method deletes the route and all its orders without validating them. The orders are taken from the route itself, so you don’t need to pass them. If a route with the specified ID doesn’t exist, the method doesn’t return an error.

Response

For create, update, and delete, the response is returned in the following format:

Copied!
{
	"orders":[{
		"id":<uint>,		/* order ID */ 
		"f":<uint>,		/* order flags */
		"u":<uint>,		/* unit ID */
		"uid":<uint>,		/* order UID */
		"callMode":"<text>"
	},
	...
	]
}

For register and purge, the response is an empty object {}.

If the request fails, an error code is returned.

Error codes

Error code Description
4 Logic error. See the reason in the response. For example, ROUTE_NOT_SPECIFIED if no route ID is specified, or ROUTE_NOT_FOUND if the route specified in id or the route to register doesn’t exist.
6 Failed to create, update, or register the route, or to delete an order.
7 Invalid resource ID.

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