Menu
AWS IoT
Developer Guide

UpdateJobExecution

Updates the status of a job execution.

Request syntax:

POST /things/thingName/jobs/jobId Content-type: application/json { "status": "string", "statusDetails": { "string": "string" }, "expectedVersion": "long", "includeJobExecutionState": "boolean", "includeJobDocument": "boolean", "executionNumber": "long" }

URI Request Parameters:

Name

Type

Req?

Description

jobId

JobId

yes

The unique identifier assigned to this job when it was created.

thingName

ThingName

yes

The name of the thing associated with the device.

Request Body Parameters:

Name

Type

Req?

Description

status

JobExecutionStatus

yes

The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.

statusDetails

DetailsMap

no

Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.

expectedVersion

ExpectedVersion

no

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

includeJobExecutionState

IncludeExecutionState

no

Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.

includeJobDocument

IncludeJobDocument

no

Optional. When set to true, the response contains the job document. The default is false.

executionNumber

ExecutionNumber

no

Optional. A number that identifies a particular job execution on a particular device.

Response syntax:

Content-type: application/json { "executionState": { "status": "string", "statusDetails": { "string": "string" }, "versionNumber": "long" }, "jobDocument": "string" }

Response Body Parameters:

Name

Type

Req?

Description

executionState

JobExecutionState

no

A JobExecutionState object.

jobDocument

JobDocument

no

The contents of the Job Documents.

Errors:

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 response code: 400

ResourceNotFoundException

The specified resource does not exist.

HTTP response code: 404

ThrottlingException

The rate exceeds the limit.

HTTP response code: 429

ServiceUnavailableException

The service is temporarily unavailable.

HTTP response code: 503

CertificateValidationException

The certificate is invalid.

HTTP response 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 response code: 409

CLI

Synopsis:

aws iot-jobs-data update-job-execution \ --job-id <value> \ --thing-name <value> \ --status <value> \ [--status-details <value>] \ [--expected-version <value>] \ [--include-job-execution-state | --no-include-job-execution-state] \ [--include-job-document | --no-include-job-document] \ [--execution-number <value>] \ [--cli-input-json <value>] \ [--generate-cli-skeleton]

cli-input-json format:

{ "jobId": "string", "thingName": "string", "status": "string", "statusDetails": { "string": "string" }, "expectedVersion": "long", "includeJobExecutionState": "boolean", "includeJobDocument": "boolean", "executionNumber": "long" }

cli-input-json fields:

Name

Type

Description

jobId

string

length max:64 min:1

pattern: [a-zA-Z0-9_-]+

The unique identifier assigned to this job when it was created.

thingName

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

The name of the thing associated with the device.

status

string

enum: QUEUED | IN_PROGRESS | SUCCEEDED | FAILED | REJECTED | REMOVED | CANCELED

java class: com.amazonaws.iot.laser.common.JobExecutionStatus

The new status for the job execution (IN_PROGRESS, FAILED, SUCCESS, or REJECTED). This must be specified on every update.

statusDetails

map

key: DetailsKey

value: DetailsValue

Optional. A collection of name/value pairs that describe the status of the job execution. If not specified, the statusDetails are unchanged.

DetailsKey

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

DetailsValue

string

length max:1024 min:1

pattern: [^\\p{C}]*+

expectedVersion

long

java class: java.lang.Long

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

includeJobExecutionState

boolean

java class: java.lang.Boolean

Optional. When included and set to true, the response contains the JobExecutionState data. The default is false.

includeJobDocument

boolean

java class: java.lang.Boolean

Optional. When set to true, the response contains the job document. The default is false.

executionNumber

long

java class: java.lang.Long

Optional. A number that identifies a particular job execution on a particular device.

Output:

{ "executionState": { "status": "string", "statusDetails": { "string": "string" }, "versionNumber": "long" }, "jobDocument": "string" }

cli output fields:

Name

Type

Description

executionState

JobExecutionState

A JobExecutionState object.

status

string

enum: QUEUED | IN_PROGRESS | SUCCEEDED | FAILED | REJECTED | REMOVED | CANCELED

java class: com.amazonaws.iot.laser.common.JobExecutionStatus

The status of the job execution. Can be one of: "QUEUED", "IN_PROGRESS", "FAILED", "SUCCESS", "CANCELED", "REJECTED", or "REMOVED".

statusDetails

map

key: DetailsKey

value: DetailsValue

A collection of name/value pairs that describe the status of the job execution.

DetailsKey

string

length max:128 min:1

pattern: [a-zA-Z0-9:_-]+

DetailsValue

string

length max:1024 min:1

pattern: [^\\p{C}]*+

versionNumber

long

The version of the job execution. Job execution versions are incremented each time they are updated by a device.

jobDocument

string

length max:32768

The contents of the Job Documents.

On this page: