update_job
The update_job method is used to create, edit, or delete jobs.
svc=resource/update_job¶ms={
"itemId":<long>,
"id":<long>,
"callMode":"<text>",
"n":"<text>",
"d":"<text>",
"r":"<text>",
"at":<uint>,
"m":<uint>,
"fl":<uint>, /* optional: 1 (delete the job after its first execution), 0 (keep the job). Default: 0 */
"tz":<int>,
"l":"<text>",
"e":<bool>,
"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 (0 to create a job). |
| callMode | Action: create, update, delete. |
Other parameters are only required for creating and updating. See the get_job_data page.
Units and unit groups specified in the units parameter of the job action (act.p.units) are added to the job only if the creator of the resource has the Use unit in jobs, notifications, routes, retranslators access right to them. Other units are skipped without an error.
Response
For creation and modification requests:
[
<long>, /* job ID */
{
"id":<long>, /* job ID */
"n":"<text>", /* name */
"d":"<text>", /* description */
"m":<uint>, /* maximum executions count, 0 (unlimited) */
"st":{ /* state */
"e":<uint>, /* enabled/disabled */
"c":<uint>, /* executions count */
"l":<uint> /* last execution time */
},
"act":"<text>", /* action */
"ct":<uint>, /* creation time */
"mt":<uint> /* last modification time */
}
]
All the possible action types are described in the Action types section.
For deletion requests:
[
<long>, /* job ID */
null
]
Possible error codes:
| Code | Description |
|---|---|
| 7 | The resource doesn’t exist, or the user doesn’t have the Create, edit, and delete jobs access right to it. |
| 6 | Undefined error. |
| 4 | Wrong input parameters. |