UpdateJobExecution
Updates the status of a job execution.
Requires permission to access the UpdateJobExecution action.
Request Syntax
POST /things/thingName
/jobs/jobId
?namespaceId=namespaceId
HTTP/1.1
Content-type: application/json
{
"executionNumber": number
,
"expectedVersion": number
,
"includeJobDocument": boolean
,
"includeJobExecutionState": boolean
,
"status": "string
",
"statusDetails": {
"string
" : "string
"
},
"stepTimeoutInMinutes": number
}
URI Request Parameters
The request uses the following URI parameters.
- jobId
-
The unique identifier assigned to this job when it was created.
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Required: Yes
- namespaceId
-
The namespace used to indicate that a job is a customer-managed job.
When you specify a value for this parameter, AWS IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.
$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/
Note
The
namespaceId
feature is only supported by AWS IoT Greengrass at this time. For more information, see Setting up AWS IoT Greengrass core devices.Pattern:
[a-zA-Z0-9_-]+
- thingName
-
The name of the thing associated with the device.
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.
- executionNumber
-
Optional. A number that identifies a particular job execution on a particular device.
Type: Long
Required: No
- 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
- includeJobDocument
-
Optional. When set to true, the response contains the job document. The default is false.
Type: Boolean
Required: No
- includeJobExecutionState
-
Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.
Type: Boolean
Required: No
- status
-
The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.
Type: String
Valid Values:
QUEUED | IN_PROGRESS | SUCCEEDED | FAILED | TIMED_OUT | REJECTED | REMOVED | CANCELED
Required: Yes
- statusDetails
-
Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.
The maximum length of the value in the name/value pair is 1,024 characters.
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
- stepTimeoutInMinutes
-
Specifies the amount of time this device has to finish execution of this job. If the job execution status is not set to a terminal state before this timer expires, or before the timer is reset (by again calling
UpdateJobExecution
, setting the status toIN_PROGRESS
, and specifying a new timeout value in this field) the job execution status will be automatically set toTIMED_OUT
. Note that setting or resetting the step timeout has no effect on the in progress timeout that may have been specified when the job was created (CreateJob
using fieldtimeoutConfig
).Valid values for this parameter range from 1 to 10080 (1 minute to 7 days). A value of -1 is also valid and will cancel the current step timer (created by an earlier use of
UpdateJobExecutionRequest
).Type: Long
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"executionState": {
"status": "string",
"statusDetails": {
"string" : "string"
},
"versionNumber": number
},
"jobDocument": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- executionState
-
A JobExecutionState object.
Type: JobExecutionState object
- jobDocument
-
The contents of the Job Documents.
Type: String
Length Constraints: Maximum length of 32768.
Errors
- CertificateValidationException
-
The certificate is invalid.
HTTP Status Code: 400
- InvalidRequestException
-
The contents of the request were invalid.
HTTP Status Code: 400
- InvalidStateTransitionException
-
An update attempted to change the job execution to a state that is invalid because of the job execution's current state (for example, an attempt to change a request in state SUCCESS to state IN_PROGRESS). In this case, the body of the error message also contains the executionState field.
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
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: