Difference between revisions of "Link jobs"
From MyMobileWorkers API
(Created page with "The status of a job can be changed remotely by placing requests against the API. == Summary == {| border="1" class="wikitable" ! Update job status ! colspan="2" | |- ! URL ...") |
(→Summary) |
||
| Line 8: | Line 8: | ||
|- | |- | ||
! URL | ! URL | ||
| − | | colspan="2" | https://:base_url/:api_path/:version/jobs | + | | colspan="2" | https://:base_url/:api_path/:version/jobs/job/link?api_key=YOUR_KEY&previous_job_number=JOB_NUMBER&new_job_number=JOB_NUMBER |
|- | |- | ||
! Type | ! Type | ||
| Line 26: | Line 26: | ||
|} | |} | ||
| − | |||
| − | |||
== Valid status transitions == | == Valid status transitions == | ||
{| border="1" class="wikitable" | {| border="1" class="wikitable" | ||
Revision as of 12:19, 6 November 2019
The status of a job can be changed remotely by placing requests against the API.
Contents |
Summary
| Update job status | ||
|---|---|---|
| URL | https://:base_url/:api_path/:version/jobs/job/link?api_key=YOUR_KEY&previous_job_number=JOB_NUMBER&new_job_number=JOB_NUMBER | |
| Type | POST | |
| Params: | api_key | required |
| job_number | required | |
| status | required | |
| Response | JSON | |
Valid status transitions
| Current status | Possible status | |
|---|---|---|
| NEW | JOB_COMPLETED | |
| NEW | JOB_FAILED | |
| NEW | CUSTOM_COMPLETED_TYPE | |
| NEW | CUSTOM_NEW_TYPE | |
| JOB_COMPLETED | JOB_FAILED | |
| JOB_FAILED | JOB_COMPLETED | |
| CUSTOM_COMPLETED_TYPE | CUSTOM_COMPLETED_TYPE | |
- CUSTOM_COMPLETED_TYPE statuses are defined within the web portal under the settings menu. They will always be defaulted to uppercase.
Example success response
{"successful":[{"job_number":"123456"}]}
Example failure response
{"failed":[{"job_number":"123456","errors":[{"error_code":"STA001","error_message":"Invalid job status specified"}]}]}
Example curl request
curl -X POST "https://api.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_COMPLETED"
curl -X POST "https://api.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_FAILED"