Difference between revisions of "Setting the status of a job"
(→Valid status transitions) |
|||
| Line 56: | Line 56: | ||
{| border="1" class="wikitable" | {| border="1" class="wikitable" | ||
| − | ! Current status | + | ! Current status | colspan="2" | New status |
|- | |- | ||
|} | |} | ||
Revision as of 09:44, 9 August 2016
Summary
| Update job status | ||
|---|---|---|
| URL | https://:base_url/:api_path/:version/jobs//job/status/update?api_key=YOUR_KEY&&job_number=JOB_NUMBER&status=JOB_STATUS | |
| Type | POST | |
| Params: | api_key | required |
| job_number | required | |
| status | required | |
| Response | JSON | |
The status of a job can be changed remotely by placing requests against the API.
Please refer to the List_of_Job_Statuses when placing an API call. In addition if your My Mobile Workers account defines any custom statuses then the API can also be used to update jobs with these.
In order to make a valid API request it must contain the following parameters
1. A MyMobileWorkers web API key 2. The job number that you wish to update the status of 3. The status you with to update the job to
The curl tool can be used to place requests against the API in order to test connectivity to the API. Please substitute within the call <<YOUR_WEB_API_KEY>> and <<YOUR_JOB_NUMBER>> with values from your portal account
curl -X POST "https://live.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=<<YOUR_WEB_API_KEY>>&job_number=<<YOUR_JOB_NUMBER>>&status=JOB_COMPLETED"
The above request will transition the status of a job to JOB_COMPLETED if the job presently has the status NEW.
Within the MyMobileWorkers system statuses have a status type. The type of a status dictates which status changes can be made through the API.
NEW -> JOB_COMPLETED type completed NEW -> JOB_FAILED type completed
JOB_COMPLETED -> JOB_FAILED JOB_FAILED -> JOB_COMPLETED
NEW -> custom completed type
custom completed type -> custom completed type
Valid status transitions
| colspan="2" | New status |
|---|
Example curl request
curl -X POST "https://live.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_COMPLETED"
curl -X POST "https://live.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_FAILED"