:doc:`IoT <../../iot>` / Client / list_command_executions

***********************
list_command_executions
***********************



.. py:method:: 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) <https://docs.aws.amazon.com/iot/latest/developerguide/iot-remote-command-execution-start-monitor.html#iot-remote-command-execution-list-cli>`__.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iot-2015-05-28/ListCommandExecutions>`_  


  **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'
    )
    
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return in this operation.

    

  
  :type nextToken: string
  :param nextToken: 

    To retrieve the next set of results, the ``nextToken`` value from a previous response; otherwise ``null`` to receive the first set of results.

    

  
  :type namespace: string
  :param namespace: 

    The namespace of the command.

    

  
  :type status: string
  :param status: 

    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.

    

  
  :type sortOrder: string
  :param sortOrder: 

    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.

    

  
  :type startedTimeFilter: dict
  :param startedTimeFilter: 

    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.

      

    
  
  :type completedTimeFilter: dict
  :param completedTimeFilter: 

    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.

      

    
  
  :type targetArn: string
  :param targetArn: 

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

    

  
  :type commandArn: string
  :param commandArn: 

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

    

  
  
  :rtype: 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**
  
  *   :py:class:`IoT.Client.exceptions.ValidationException`

  
  *   :py:class:`IoT.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`IoT.Client.exceptions.ThrottlingException`

  
  *   :py:class:`IoT.Client.exceptions.InternalServerException`

  