Update job
To update a job, send a PATCH request to https://api.planadoapp.com/v2/jobs/:job_id. :job_id can be an external_id or a uuid value. Fields listed in the query will be updated:
$ curl -H "Authorization: Bearer api-key" \
-X PATCH \
--data "{\"description\": \"Updated description\"}" \
https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
{
"job_uuid": "8070f98d-b3f6-4cc8-b7c4-54b6709cd98b"
}
Request schema
All fields are optional.
| Field | Type | JSON type | Required | Can be null |
Description |
|---|---|---|---|---|---|
|
String |
String |
No |
Yes |
Text value describing the work to be done. Limited to 15000 characters |
|
Datetime |
String |
No |
Yes |
Planned job start time |
|
Object |
No |
Yes |
Planned job duration |
|
|
Object |
No |
Yes |
Worker or team assigned to the job |
|
|
Array |
No |
No |
List of assignees. |
|
|
Array |
No |
No |
List of possible resolutions. |
|
|
Object |
No |
No |
Address fields |
|
|
[Contact] |
Array |
No |
No |
List of contacts |
|
Object |
No |
Yes |
Client |
|
|
Object |
No |
Yes |
Site |
|
|
Object |
No |
Yes |
Territory |
|
|
[Skill] |
Array |
No |
No |
Skills required to complete the job |
|
Array |
No |
No |
Values of custom job fields |
|
|
Array |
No |
No |
Values of job report fields |
|
|
Integer |
Number |
No |
No |
The job’s |
Some of the fields, such as possible_resolutions, assignees, or assignee, cannot be updated in started jobs.
Conditional update
To avoid overwriting a change made after you read the job (for example, a dispatcher’s manual edit of the duration), pass expected_version: the version returned by the job request. Planado checks the version and writes the update atomically, so a change made after your read is never overwritten.
$ curl -H "Authorization: Bearer api-key" \
-X PATCH \
--data "{\"scheduled_duration\": {\"minutes\": 90}, \"expected_version\": 5}" \
https://api.planadoapp.com/v2/jobs/8070f98d-b3f6-4cc8-b7c4-54b6709cd98b | jq
If the job’s version is no longer expected_version, nothing is written and the response is 409 Conflict:
{
"code": "stale_version",
"retryable": false
}
Any change to the job increases its version, not only a change to the fields you send: a status change by a worker, for example. On stale_version, request the job again, decide whether the update is still needed and send it with the new version.
Without expected_version, the update is applied to the current state of the job. In both cases the response may also be 409 Conflict with "code": "version_conflict" and "retryable": true when the job is being changed concurrently: repeat the same request.
Updating and adding fields
See examples.