Menu
AWS IoT
API Reference

UpdateJobExecution

Updates the status of a job execution.

Request Syntax

POST /things/thingName/jobs/jobId HTTP/1.1
Content-type: application/json

{
   "executionNumber": number,
   "expectedVersion": number,
   "includeJobDocument": boolean,
   "includeJobExecutionState": boolean,
   "status": "string",
   "statusDetails": { 
      "string" : "string" 
   }
}

URI Request Parameters

The request requires 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_-]+

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:_-]+

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 | 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.

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. Maximum length of 1024.

Value Pattern: [^\p{C}]*+

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. For example, this code is returned when an UpdateJobExecution request contains invalid status details. The message contains details about the error.

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: 429

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: