Command disabled: backlink

Jobs: create, edit, delete

To create, edit or delete jobs, use the command resource/update_job:

svc=resource/update_job&params={"itemId":<long>,
				"id":<long>,
				"callMode":<text>,
				"n":<text>,
				"d":<text>,
				"r":<text>,
				"at":<uint>,
				"m":<uint>,
				"tz":<int>,
				"l":<text>,
				"sch":{
					"f1":<uint>,
					"f2":<uint>,
					"t1":<uint>,
					"t2":<uint>,
					"m":<uint>,
					"y":<uint>,
					"w":<uint>
				},					
				"act":{	
					"t":<text>,
					"p":{
						<text>:<text>,
						...
					}					
				}}

Parameters

Name Description
itemId resource ID
id job ID
callMode action: create, update, delete
Parameters required only for create and update:
n name
d description
r execution type
Execution can be either of two types: form a detailed list of execution times or set an interval between executions. If you choose the first option (exact schedule), the format of r field should be “1 …” (after 1 you indicate execution time and if there are several, separate them by space). Time format can be either “hours:minutes” or just “hours”. If you choose the second option (constant interval between executions), the format of r field should be “2 …” (after 2 indicate time interval in Unix format).
at activation time
m maximal executions count, 0 - unlimited
tz time zone (sec)
l language used for job
sch time limitation
f1 beginning of interval 1
f2 beginning of interval 2
t1 ending of interval 1
t2 ending of interval 2
m days of month mask
y months mask
w days of week mask
act actions (list of actions see below)
t type
p parameters - name: value

Response

On create and edit:

[
	<long>,		/* job ID  */
	{
		"id":<long>,	/* job ID  */
		"n":<text>,	/* name */
		"d":<text>,	/* description */
		"r":<text>,	/* execution type */
		"at":<uint>,	/* activation time */
		"m":<uint>,	/* maximal executions count, 0 - unlimited */
		"tz":<long>,	/* time zone (sec) */
		"l":<text>,
		"st":{		/* state */
			"e":<uint>,	/* enabled/disabled */
			"c":<uint>,	/* executions coun */
			"l":<uint>	/* time of last execution */
		},
		"sch":{		/* time limitation */
			"f1":<uint>,	/* beginning of interval 1 */
			"f2":<uint>,	/* beginning of interval 2 */
			"t1":<uint>,	/* ending of interval 1 */
			"t2":<uint>,	/* ending of interval 2 */
			"mdm":<uint>,	/* days of month mask */
			"ymm":<uint>,	/* months mask */
			"wdm":<uint>	/* days of week mask */
		},
		"act":{		/* actions (list of actions see below) */
			"t":<text>,	/* type */
			"p":{		/* parameters */
				<text>:<text>,	/* name: value */
				...
			}
		}
	}
]

On delete:

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

Errors

Code Value
1 invalid session
2 invalid service name
3 invalid result
4 invalid format or value of parameters
6 - job with current ID doesn't exist
- error deleting job
7 service is not activated

Action types

Execute a command over unit(s)

"act":{
	"t":"exec_unit_cmd",		/* action type */
	"p":{
		"cmd_name":<text>,	/* command name */
		"cmd_param":<text>,	/* command parameter */
		"link_type":<text>,	/* link type */
		"timeout":<text>,	/* during this time system will try to execute command, sec */
		"units":<text>		/* list of units GUIDs (comma-separated) */
	}
}

Link types you can find in chapter Execute command.

GPRS traffic accounting

"act":{
	"t":"reset_unit_bytes_counter",	/* action type */
	"p":{
		"reset_bytes":<text>,	/* reset counter value (1 - yes, 0 - no) */
		"store_bytes":<text>,	/* store counter value in unit log (1 - yes, 0 - no) */
		"units":<text>		/* list of units GUIDs (comma-separated) */
	}
}

Modify users access level

"act":{
	"t":"change_access_user",	/* action type */
	"p":{
		"acc_level":<text>,	/* access rights */
		"units":<text>,		/* list of units GUIDs (comma-separated) */
		"users":<text>		/* list of users GUIDs (comma-separated) */
	}
}

Access rights are described in chapter Get access level.

Mileage accounting

"act":{
	"t":"reset_unit_mileage_counter",	/* action type */
	"p":{
		"param_name":<text>,		/* parameter name, if empty - don't save counter value as parameter for unit data messages */
		"skip_reset":<text>,		/* set new value for mileage counter (0 - yes, 1 - no) */
		"store_mileage":<text>,		/* store counter value in unit log */
		"units":<text>,			/* list of units GUIDs (comma-separated) */
		"value_mileage":<text>		/* new value of mileage counter (meters) */
	}
}

Engine hours accounting

"act":{
	"t":"reset_unit_engine_hours_counter",	/* action type */
	"p":{
		"param_name":<text>,		/* parameter name */
		"skip_reset":<text>,		/* set new value of engine hours counter (0 - yes, 1 - no) */
		"store_eh":<text>,		/* store counter value in unit log */
		"units":<text>,			/* list of units GUIDs (comma-separated) */
		"value_eh":<text>		/* new value of engine hours counter (seconds) */
	}
}

Send fuel information by e-mail or SMS

"act":{
	"t":"send_email_sms_fuel",	/* action typeя */
	"p":{
		"email_to":<text>,	/* comma-separated e-mail addresses */
		"flags":<text>,		/* flags (see below)  */
		"phone_to":<text>,	/* phone numbers */
		"time_offset":<text>,	/* time offset, min */
		"units":<text>		/* list of units GUIDs (comma-separated) */
	}
}

Flags:

Value Description
0x01 Separate message for each unit
0x02 All units in one message
0x04 Event type: Filling
0x08 Event type: Theft
0x10 Event type: Fuel level
0x20 Method of delivery: e-mail
0x40 Method of delivery: SMS

Send a report by e-mail

"act":{
	"t":"send_email_report",	/* action type */
	"p":{
		"email_to":<text>,	/* comma-separeted e-mail addresses */
		"file_type":<text>,	/* file format (see below) */
		"flags":<text>,		/* interval flags */
		"pack":<text>,		/* compress report files: 0 - no, 1 - yes */
		"params":<text>,	/* report configuration (xml) */
		"report_guid":<text>,	/* resource GUID */
		"report_id":<text>,	/* report template index */
		"report_objects":<text>,/* list of comma-separated units GUIDs */
		"time_from":<text>,	/* beginning of time interval */
		"time_to":<text>	/* ending of time interval */
	}
}

Interval flags are described in the chapter Reports: Execute report.

File formats:

  • 1 - html;
  • 2 - pdf;
  • 4 - xls;
  • 8 - xlsx;
  • 16 - xml;
  • 32 - csv.

Assign route

"act":{
	"t":"assign_route",	/* action type */
	"p":{
		"units":<text>		/* list of units GUIDs (comma-separated) */
		"name":<text>,		/* name */
		"description":<text>,	/* description */
		"zone":<text>,		/* geofence index */
		"flags":<text>		/* route flags */
	}
}

Route flags are described in the chapter Routes: create, edit, delete.

Remove route

"act":{
	"t":"remove_route",	
	"p":{
		"units":<text>,		/* list of units GUIDs (comma-separated) */
		"finished":<text>	/* remove only finished routes: 1 - yes, 0 - no */
	}
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam