IoT / Client / get_command_execution

get_command_execution#

IoT.Client.get_command_execution(**kwargs)#

Gets information about the specific command execution on a single device.

See also: AWS API Documentation

Request Syntax

response = client.get_command_execution(
    executionId='string',
    targetArn='string',
    includeResult=True|False
)
Parameters:
  • executionId (string) –

    [REQUIRED]

    The unique identifier for the command execution. This information is returned as a response of the StartCommandExecution API request.

  • targetArn (string) –

    [REQUIRED]

    The Amazon Resource Number (ARN) of the device on which the command execution is being performed.

  • includeResult (boolean) – Can be used to specify whether to include the result of the command execution in the GetCommandExecution API response. Your device can use this field to provide additional information about the command execution. You only need to specify this field when using the AWS-IoT namespace.

Return type:

dict

Returns:

Response Syntax

{
    'executionId': 'string',
    'commandArn': 'string',
    'targetArn': 'string',
    'status': 'CREATED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'REJECTED'|'TIMED_OUT',
    'statusReason': {
        'reasonCode': 'string',
        'reasonDescription': 'string'
    },
    'result': {
        'string': {
            'S': 'string',
            'B': True|False,
            'BIN': b'bytes'
        }
    },
    'parameters': {
        'string': {
            'S': 'string',
            'B': True|False,
            'I': 123,
            'L': 123,
            'D': 123.0,
            'BIN': b'bytes',
            'UL': 'string'
        }
    },
    'executionTimeoutSeconds': 123,
    'createdAt': datetime(2015, 1, 1),
    'lastUpdatedAt': datetime(2015, 1, 1),
    'startedAt': datetime(2015, 1, 1),
    'completedAt': datetime(2015, 1, 1),
    'timeToLive': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • executionId (string) –

      The unique identifier of the command execution.

    • commandArn (string) –

      The Amazon Resource Number (ARN) of the command. For example, arn:aws:iot:<region>:<accountid>:command/<commandId>

    • targetArn (string) –

      The Amazon Resource Number (ARN) of the device on which the command execution is being performed.

    • status (string) –

      The status of the command execution. After your devices receive the command and start performing the operations specified in the command, it can use the UpdateCommandExecution MQTT API to update the status information.

    • statusReason (dict) –

      Your devices can use this parameter to provide additional context about the status of a command execution using a reason code and description.

      • reasonCode (string) –

        A code that provides additional context for the command execution status.

      • reasonDescription (string) –

        A literal string for devices to optionally provide additional information about the reason code for a command execution status.

    • result (dict) –

      The result value for the current state of the command execution. The status provides information about the progress of the command execution. The device can use the result field to share additional details about the execution such as a return value of a remote function call.

      Note

      If you use the AWS-IoT-FleetWise namespace, then this field is not applicable in the API response.

      • (string) –

        • (dict) –

          The result value of the command execution. The device can use the result field to share additional details about the execution such as a return value of a remote function call.

          Note

          This field is not applicable if you use the AWS-IoT-FleetWise namespace.

          • S (string) –

            An attribute of type String. For example:

            "S": "Hello"

          • B (boolean) –

            An attribute of type Boolean. For example:

            "BOOL": true

          • BIN (bytes) –

            An attribute of type Binary.

    • parameters (dict) –

      The list of parameters that the StartCommandExecution API used when performing the command on the device.

      • (string) –

        • (dict) –

          The range of possible values that’s used to describe a specific command parameter.

          Note

          The commandParameterValue can only have one of the below fields listed.

          • S (string) –

            An attribute of type String. For example:

            "S": "Hello"

          • B (boolean) –

            An attribute of type Boolean. For example:

            "BOOL": true

          • I (integer) –

            An attribute of type Integer (Thirty-Two Bits).

          • L (integer) –

            An attribute of type Long.

          • D (float) –

            An attribute of type Double (Sixty-Four Bits).

          • BIN (bytes) –

            An attribute of type Binary. For example:

            "B": "dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk"

          • UL (string) –

            An attribute of type unsigned long.

    • executionTimeoutSeconds (integer) –

      Specifies the amount of time in seconds that the device can take to finish a command execution. A timer starts when the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to TIMED_OUT.

    • createdAt (datetime) –

      The timestamp, when the command execution was created.

    • lastUpdatedAt (datetime) –

      The timestamp, when the command execution was last updated.

    • startedAt (datetime) –

      The timestamp, when the command execution was started.

    • completedAt (datetime) –

      The timestamp, when the command execution was completed.

    • timeToLive (datetime) –

      The time to live (TTL) parameter that indicates the duration for which executions will be retained in your account. The default value is six months.

Exceptions