Routes: create, edit, delete

To create, edit or delete routes, use the command resource/update_route:

svc=resource/update_route&params={"itemId":<long>,
				  "id":<long>,
				  "callMode":<text>,
				  "resourceId":<long>,
				  "zoneId":<long>,
				  "d":<text>,
				  "n":<text>,
				  "f":<long>,
				  "at":<long>}

Parameters

Name Description
itemId resource ID
id route ID
callMode action: create, update, delete
Parameters required only for create and update:
resourceId resource ID
zoneId ID of geofence, which will be used as route
d description
n route name
f route flags (see below)
at activation time

Route flags:

Flag Description
0x1 geofence defined by reference
0x2 remove finished rounds from the timeline
0x8 register as data message of a unit
0x10 check points order: skipping possible
0x20 generate event for unit
0x40 check points order: arbitrary

Response

On create and edit:

[
	<long>,		/* route ID */
	{
		"i":<long>,	/* route ID */
		"nm":<text>,	/* name */
		"de":<text>,	/* description */
		"at":<uint>,	/* activation time */
		"fl":<long>,	/* route flags (see above) */
		"st":<long>,	/* route state (see below) */
		"pt":<uint>,	/* index of last visited point of route */
		"tm":<uint>,	/* status change time */
		"ri":<long>,	/* resource ID */
		"z":<long>	/* geofence ID */
	}
]

Route state flags:

Flag Description
0x01 state check not active
0x02 all check points are finished
0x04 arrival to check point
0x08 departure from check point
0x10 unit is out of route geofence
0x20 unit is moving with a delay
0x40 unit is moving ahead
0x80 state check not active is forbidden

On delete:

[
	<long>,		/* route ID */
	null
]

Errors

Code Value
1 invalid session
2 invalid service name
3 invalid result
4 invalid format or value of parameters
6 - access denied
- service is not activated
- geofence with current ID doesn't exist
- route with current ID doesn't exist
- error deleting route
- error updating route
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2019 Gurtam