get_job_data
The get_job_data function is used to receive detailed information about the specified jobs.
svc=resource/get_job_data¶ms={"itemId":<long>,
"col":[<long>]}
Parameters
Name | Description |
---|---|
itemId | Resource ID. |
col | The array of job IDs. The field is optional. If it is not present, the function is executed for all the jobs. |
Returned result
[
{
"id":<long>, /* job ID */
"n":"<text>", /* name */
"d":"<text>", /* description */
"r":"<text>", /* execution type (see below) */
"at":<uint>, /* activation time */
"m":<uint>, /* maximum executions limit, 0 — unlimited */
"fl":<uint>, /* delete the job when the maximum executions limit is reached, 1 — yes */
"tz":<int>, /* time zone, sec */
"l":"<text>", /* language used for the job */
"st":{ /* state */
"e":<int>, /* enabled/disabled */
"c":<uint>, /* executions count */
"l":<uint> /* last execution time */
},
"sch":{ /* time limitation */
"f1":<uint>, /* the beginning of the interval 1 */
"f2":<uint>, /* the beginning of the interval 2 */
"t1":<uint>, /* the end of the interval 1 */
"t2":<uint>, /* the end of the interval 2 */
"m":<uint>, /* the mask of days of month */
"y":<uint>, /* the mask of months */
"w":<uint>, /* the mask of days of week */
"fl":<int> /* schedule flags */
},
"act":{ /* actions (see the list of actions) */
"t":"<text>", /* type */
"p":{ /* parameters */
"<text>":"<text>", /* name: value */
...
}
},
"ct":<uint>, /* creation time */
"mt":<uint> /* last modification time */
}
]
There are two available types of execution:
- Form a detailed list of executions according to a precise schedule. In this case, the format of the r field is “1 …”, where after 1, the execution time should be indicated. If there should be several executions, use a space to separate their time. The time format is “hours:minutes” or “hours”.
- Set an interval between executions. If there should be a definite interval between job executions, the format of the r field is “2 …”, where after 2, indicate in Unix format the interval after which the job must be executed iteratively.
Action types
The following types of actions are available for jobs:
- Send a command to units;
- Change access to units;
- Send a report by email;
- Send fuel information by email or SMS;
- Mileage counters;
- Engine hours counters;
- GPRS traffic counters.
Send a command to units
"act":{
"t":"exec_unit_cmd", /* action type */
"p":{
"cmd_name":"<text>", /* command name */
"cmd_type":"<text>", /* command type */
"cmd_param":"<text>", /* command parameter */
"link_type":"<text>", /* link type */
"timeout":"<text>", /* the time during which the system will try to execute the command, s */
"units":"<text>" /* the list of IDs of units/unit groups (separated by commas) */
}
}
You can find the list of available command types here.
Change access to units
"act":{
"t":"change_access_user", /* action type */
"p":{
"acl_bits":"<text>", /* 1 — set bit, 0 — remove bit */
"acl_mask":"<text>", /* the mask of bits to be changed */
"units":"<text>", /* the list of IDs of units/unit groups (separated by commas) */
"users":"<text>" /* the list of IDs of users (separated by commas) */
}
}
Send a report by email
"act":{
"t":"send_email_report", /* action type */
"p":{
"email_to":"<text>", /* email addresses separated by commas */
"file_type":"<text>", /* file format */
"flags":"<text>", /* interval flags */
"params":"<text>", /* report configuration (XML) */
"report_guid":"<text>", /* resource ID */
"report_id":"<text>", /* report template ID */
"report_objects":"<text>",/* the list of unit IDs separated by commas */
"time_from":"<text>", /* the beginning of time interval */
"time_to":"<text>" /* the end of time interval */
}
}
The interval flags are described here.
File formats (ZIP archive content):
- 1 — HTML;
- 2 — PDF;
- 4 — XLS;
- 8 — XLSX;
- 16 — XML;
- 32 — CSV.
Send fuel information by email or SMS
"act":{
"t":"send_email_sms_fuel", /* action type */
"p":{
"email_to":"<text>", /* email addresses separated by commas */
"flags":"<text>", /* flags (see below) */
"phone_to":"<text>", /* phone numbers */
"time_offset":"<text>", /* time offset, min */
"units":"<text>" /* the list of IDs of units/unit groups (separated by commas) */
}
}
Flags:
Value | Description |
---|---|
0x01 | Separate message for each unit. |
0x02 | All units in one message. |
0x04 | Event type: fuel filling. |
0x08 | Event type: fuel drain. |
0x10 | Event type: fuel level. |
0x20 | Delivery method: email. |
0x40 | Delivery method: SMS. |
Mileage counters
"act":{
"t":"reset_unit_mileage_counter", /* action type */
"p":{
"param_name":"<text>", /* parameter name; if it's empty, the counter value isn't stored as parameter of unit data message */
"skip_reset":"<text>", /* set new value for the mileage counter (0 — yes, 1 — no) */
"store_mileage":"<text>", /* store counter value in unit history */
"units":"<text>", /* list of IDs of units/unit groups (separated by commas) */
"value_mileage":"<text>" /* new value of mileage counter, m */
}
}
Engine hours counters
"act":{
"t":"reset_unit_engine_hours_counter", /* action type */
"p":{
"param_name":"<text>", /* parameter name; if it's empty, the counter value isn't stored as parameter of unit data message */
"skip_reset":"<text>", /* set new value for the engine hours (0 — yes, 1 — no) */
"store_eh":"<text>", /* store counter value in unit history */
"units":"<text>", /* list of IDs of units/unit groups (separated by commas) */
"value_eh":"<text>" /* new value of engine hours, s */
}
}
GPRS traffic counters
"act":{
"t":"reset_unit_bytes_counter", /* action type */
"p":{
"reset_bytes":"<text>", /* reset counter value (1 — yes, 2 — no) */
"store_bytes":"<text>", /* store counter value in unit history (1 — yes, 0 — no) */
"units":"<text>" /* list of IDs of units/unit groups (separated by commas) */
}
}
Possible error codes:
Code | Description |
---|---|
7 | Failed to fetch the resource with the desired ACL (ADF_ACL_AVL_RES_VIEW_JOBS). |
4 | Wrong input parameters. |