CancelJobExecution
Cancels the execution of a job for a given thing.
Requires permission to access the CancelJobExecution action.
Request Syntax
PUT /things/thingName
/jobs/jobId
/cancel?force=force
HTTP/1.1
Content-type: application/json
{
"expectedVersion": number
,
"statusDetails": {
"string
" : "string
"
}
}
URI Request Parameters
The request uses the following URI parameters.
- force
-
(Optional) If
true
the job execution will be canceled if it has status IN_PROGRESS or QUEUED, otherwise the job execution will be canceled only if it has status QUEUED. If you attempt to cancel a job execution that is IN_PROGRESS, and you do not setforce
totrue
, then anInvalidStateTransitionException
will be thrown. The default isfalse
.Canceling a job execution which is "IN_PROGRESS", will cause the device to be unable to update the job execution status. Use caution and ensure that the device is able to recover to a valid state.
- jobId
-
The ID of the job to be canceled.
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Required: Yes
- thingName
-
The name of the thing whose execution of the job will be canceled.
Length Constraints: Minimum length of 1. Maximum length of 128.
Pattern:
[a-zA-Z0-9:_-]+
Required: Yes
Request Body
The request accepts the following data in JSON format.
- expectedVersion
-
(Optional) The expected current version of the job execution. Each time you update the job execution, its version is incremented. If the version of the job execution stored in Jobs does not match, the update is rejected with a VersionMismatch error, and an ErrorResponse that contains the current job execution status data is returned. (This makes it unnecessary to perform a separate DescribeJobExecution request in order to obtain the job execution status data.)
Type: Long
Required: No
- statusDetails
-
A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged. You can specify at most 10 name/value pairs.
Type: String to string map
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Key Pattern:
[a-zA-Z0-9:_-]+
Value Length Constraints: Minimum length of 1.
Value Pattern:
[^\p{C}]+
Required: No
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Errors
- InvalidRequestException
-
The request is not valid.
HTTP Status Code: 400
- InvalidStateTransitionException
-
An attempt was made to change to an invalid state, for example by deleting a job or a job execution which is "IN_PROGRESS" without setting the
force
parameter.HTTP Status Code: 409
- ResourceNotFoundException
-
The specified resource does not exist.
HTTP Status Code: 404
- ServiceUnavailableException
-
The service is temporarily unavailable.
HTTP Status Code: 503
- ThrottlingException
-
The rate exceeds the limit.
HTTP Status Code: 400
- VersionConflictException
-
An exception thrown when the version of an entity specified with the
expectedVersion
parameter does not match the latest version in the system.HTTP Status Code: 409
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: