IoT / Client / list_command_executions

list_command_executions#

IoT.Client.list_command_executions(**kwargs)#

List all command executions.

Warning

  • You must provide only the startedTimeFilter or the completedTimeFilter information. If you provide both time filters, the API will generate an error. You can use this information to retrieve a list of command executions within a specific timeframe.

  • You must provide only the commandArn or the thingArn information depending on whether you want to list executions for a specific command or an IoT thing. If you provide both fields, the API will generate an error.

For more information about considerations for using this API, see List command executions in your account (CLI).

See also: AWS API Documentation

Request Syntax

response = client.list_command_executions(
    maxResults=123,
    nextToken='string',
    namespace='AWS-IoT'|'AWS-IoT-FleetWise',
    status='CREATED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'REJECTED'|'TIMED_OUT',
    sortOrder='ASCENDING'|'DESCENDING',
    startedTimeFilter={
        'after': 'string',
        'before': 'string'
    },
    completedTimeFilter={
        'after': 'string',
        'before': 'string'
    },
    targetArn='string',
    commandArn='string'
)
Parameters:
  • maxResults (integer) – The maximum number of results to return in this operation.

  • nextToken (string) – To retrieve the next set of results, the nextToken value from a previous response; otherwise null to receive the first set of results.

  • namespace (string) – The namespace of the command.

  • status (string) – List all command executions for the device that have a particular status. For example, you can filter the list to display only command executions that have failed or timed out.

  • sortOrder (string) – Specify whether to list the command executions that were created in the ascending or descending order. By default, the API returns all commands in the descending order based on the start time or completion time of the executions, that are determined by the startTimeFilter and completeTimeFilter parameters.

  • startedTimeFilter (dict) –

    List all command executions that started any time before or after the date and time that you specify. The date and time uses the format yyyy-MM-dd'T'HH:mm.

    • after (string) –

      Filter to display command executions that started or completed only after a particular date and time.

    • before (string) –

      Filter to display command executions that started or completed only before a particular date and time.

  • completedTimeFilter (dict) –

    List all command executions that completed any time before or after the date and time that you specify. The date and time uses the format yyyy-MM-dd'T'HH:mm.

    • after (string) –

      Filter to display command executions that started or completed only after a particular date and time.

    • before (string) –

      Filter to display command executions that started or completed only before a particular date and time.

  • targetArn (string) – The Amazon Resource Number (ARN) of the target device. You can use this information to list all command executions for a particular device.

  • commandArn (string) – The Amazon Resource Number (ARN) of the command. You can use this information to list all command executions for a particular command.

Return type:

dict

Returns:

Response Syntax

{
    'commandExecutions': [
        {
            'commandArn': 'string',
            'executionId': 'string',
            'targetArn': 'string',
            'status': 'CREATED'|'IN_PROGRESS'|'SUCCEEDED'|'FAILED'|'REJECTED'|'TIMED_OUT',
            'createdAt': datetime(2015, 1, 1),
            'startedAt': datetime(2015, 1, 1),
            'completedAt': datetime(2015, 1, 1)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • commandExecutions (list) –

      The list of command executions.

      • (dict) –

        Summary information about a particular command execution.

        • commandArn (string) –

          The Amazon Resource Name (ARN) of the command execution.

        • executionId (string) –

          The unique identifier of the command execution.

        • targetArn (string) –

          The Amazon Resource Name (ARN) of the target device for which the command is being executed.

        • status (string) –

          The status of the command executions.

        • createdAt (datetime) –

          The date and time at which the command execution was created for the target device.

        • startedAt (datetime) –

          The date and time at which the command started executing on the target device.

        • completedAt (datetime) –

          The date and time at which the command completed executing on the target device.

    • nextToken (string) –

      The token to use to get the next set of results, or null if there are no additional results.

Exceptions