Difference between revisions of "Setting the status of a job"
From MyMobileWorkers API
m (new url) |
|||
| (24 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| + | The status of a job can be changed remotely by placing requests against the API. | ||
| + | |||
== Summary == | == Summary == | ||
{| border="1" class="wikitable" | {| border="1" class="wikitable" | ||
| Line 25: | Line 27: | ||
| − | + | ||
| − | + | == Valid status transitions == | |
| + | {| border="1" class="wikitable" | ||
| − | + | ! Current status | |
| − | + | | colspan="2" | Possible status | |
| − | + | |- | |
| − | 2 | + | ! NEW |
| − | + | | colspan="2" | JOB_COMPLETED | |
| − | + | |- | |
| − | + | ! NEW | |
| − | + | | colspan="2" | JOB_FAILED | |
| − | + | |- | |
| − | + | ! NEW | |
| + | | colspan="2" | CUSTOM_COMPLETED_TYPE | ||
| + | |- | ||
| + | ! NEW | ||
| + | | colspan="2" | CUSTOM_NEW_TYPE | ||
| + | |- | ||
| + | ! JOB_COMPLETED | ||
| + | | colspan="2" | JOB_FAILED | ||
| + | |- | ||
| + | ! JOB_FAILED | ||
| + | | colspan="2" | JOB_COMPLETED | ||
| + | |- | ||
| + | ! CUSTOM_COMPLETED_TYPE | ||
| + | | colspan="2" | 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 == | |
| + | <source lang="java">{"successful":[{"job_number":"123456"}]}</source> | ||
| − | + | == Example failure response == | |
| − | + | <source lang="java">{"failed":[{"job_number":"123456","errors":[{"error_code":"STA001","error_message":"Invalid job status specified"}]}]}</source> | |
| − | + | == Example curl request == | |
| − | + | ||
| − | + | curl -X POST "<nowiki>https://api.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_COMPLETED</nowiki>" | |
| − | + | curl -X POST "<nowiki>https://api.mymobileworkers.com:8181/api/1/jobs/job/status/update?api_key=APIKEY&job_number=JOB_NUMBER&status=JOB_FAILED</nowiki>" | |
Latest revision as of 09:19, 21 October 2016
The status of a job can be changed remotely by placing requests against the API.
Contents |
[edit] 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 | |
[edit] 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.
[edit] Example success response
{"successful":[{"job_number":"123456"}]}
[edit] Example failure response
{"failed":[{"job_number":"123456","errors":[{"error_code":"STA001","error_message":"Invalid job status specified"}]}]}
[edit] 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"