cancelJob API

Follow

Summary

Requirements

All API calls require a dedicated JSON Web Token (JWT). These are created when a user with a dedicated mobile resource logs in to the application. If you are using the API for programmatic queries, it is best to create a dedicated user for the JWT as this gets reset each time the user logs in.

Endpoint

/rest/workflow/job/cancelJob

POST

Cancels a job in Oneserve, leaving an event in the job history with notes passed in the message field.

File Format Spec

 

List of included fields
Field Name Data Type Mandatory? Description
clientId Integer Yes The ID of the client in Oneserve
clientRef Text (50) Yes if jobRef not specified The client reference of the job in Oneseve
jobRef Text (50) Yes if clientRef not specified The job reference in Oneserve
message Text (1000) Yes The notes against the event in Oneserve
cancellationType Integer Yes 0 - Not Selected
1 - Cancel
2 - Abort
reasonId Integer Yes The note ID in Oneserve
date Date No (defaults to current date) The date of cancellation

 

Request Representations

 

Example JSON Payload
{
  "clientId":"1",
  "clientRef":"J023T1",
  "jobRef":"J023T1",
  "message":"Job cancelled due to bad weather",
  "cancellationType":"1",
  "reasonId":"1",
  "date":"13/07/2020"
}

 

Available Response Representations

HTTP Code Description Schema
200 Job(s) cancelled Success or error
400 Bad Request Error
401 Unauthorized Error
403 Forbidden Error
404 Address Not Found Error
405 Method Not Allowed Error
500 Internal Server Error Error

Example Success Response

{
    "result": "success",
    "result_msg": ""
}

Troubleshooting

 

401 Unauthorized

Response

401 Unauthorized

Reason

This error occurs if the OS_REST_AUTH_TOKEN has not been provided, has expired, or does not exist in the system

Resolution

Verify your OS_REST_AUTH_TOKEN with support

403 Forbidden

Response

403 Forbidden

Reason

This error indicates that something is blocking your connection to the server

Resolution

Open a ticket with the support team with details of your connection so that your access can be verfied

404 Not Found

Response

404 Not Found

Reason

This error should only occur if the endpoint has been mistyped in some way, which will lead the call to an endpoint that does not exist

Resolution

Verify the endpoint matches the value specified in this article

405 Method Not Allowed

Response

405 Method Not Allowed

Reason

This error will occur if an unacceptable method has been used in the call such as GET or DELETE

Resolution

Ensure that you are using a POST call to this endpoint

JSONObject [field name] not found

Response

{
    "result": "fail",
    "result_msg": "JSONObject [field] not found."
}

Reason

This error occurs when a mandatory field has not been included in the call

Resolution

Make sure that your call includes the information specified in the spec above

 

Was this article helpful?
0 out of 0 found this helpful