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

*********
list_jobs
*********



.. py:method:: IoT.Client.list_jobs(**kwargs)

  

  Lists jobs.

   

  Requires permission to access the `ListJobs <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions>`__ action.

  

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


  **Request Syntax**
  ::

    response = client.list_jobs(
        status='IN_PROGRESS'|'CANCELED'|'COMPLETED'|'DELETION_IN_PROGRESS'|'SCHEDULED',
        targetSelection='CONTINUOUS'|'SNAPSHOT',
        maxResults=123,
        nextToken='string',
        thingGroupName='string',
        thingGroupId='string',
        namespaceId='string'
    )
    
  :type status: string
  :param status: 

    An optional filter that lets you search for jobs that have the specified status.

    

  
  :type targetSelection: string
  :param targetSelection: 

    Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group.

     

    .. note::

      

      We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.

      

    

  
  :type maxResults: integer
  :param maxResults: 

    The maximum number of results to return per request.

    

  
  :type nextToken: string
  :param nextToken: 

    The token to retrieve the next set of results.

    

  
  :type thingGroupName: string
  :param thingGroupName: 

    A filter that limits the returned jobs to those for the specified group.

    

  
  :type thingGroupId: string
  :param thingGroupId: 

    A filter that limits the returned jobs to those for the specified group.

    

  
  :type namespaceId: string
  :param namespaceId: 

    The namespace used to indicate that a job is a customer-managed job.

     

    When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.

     

    ``$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/``

     

    .. note::

      

      The ``namespaceId`` feature is only supported by IoT Greengrass at this time. For more information, see `Setting up IoT Greengrass core devices. <https://docs.aws.amazon.com/greengrass/v2/developerguide/setting-up.html>`__

      

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'jobs': [
              {
                  'jobArn': 'string',
                  'jobId': 'string',
                  'thingGroupId': 'string',
                  'targetSelection': 'CONTINUOUS'|'SNAPSHOT',
                  'status': 'IN_PROGRESS'|'CANCELED'|'COMPLETED'|'DELETION_IN_PROGRESS'|'SCHEDULED',
                  'createdAt': datetime(2015, 1, 1),
                  'lastUpdatedAt': datetime(2015, 1, 1),
                  'completedAt': datetime(2015, 1, 1),
                  'isConcurrent': True|False
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **jobs** *(list) --* 

        A list of jobs.

        
        

        - *(dict) --* 

          The job summary.

          
          

          - **jobArn** *(string) --* 

            The job ARN.

            
          

          - **jobId** *(string) --* 

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

            
          

          - **thingGroupId** *(string) --* 

            The ID of the thing group.

            
          

          - **targetSelection** *(string) --* 

            Specifies whether the job will continue to run (CONTINUOUS), or will be complete after all those things specified as targets have completed the job (SNAPSHOT). If continuous, the job may also be run on a thing when a change is detected in a target. For example, a job will run on a thing when the thing is added to a target group, even after the job was completed by all things originally in the group.

             

            .. note::

              

              We recommend that you use continuous jobs instead of snapshot jobs for dynamic thing group targets. By using continuous jobs, devices that join the group receive the job execution even after the job has been created.

              

            
          

          - **status** *(string) --* 

            The job summary status.

            
          

          - **createdAt** *(datetime) --* 

            The time, in seconds since the epoch, when the job was created.

            
          

          - **lastUpdatedAt** *(datetime) --* 

            The time, in seconds since the epoch, when the job was last updated.

            
          

          - **completedAt** *(datetime) --* 

            The time, in seconds since the epoch, when the job completed.

            
          

          - **isConcurrent** *(boolean) --* 

            Indicates whether a job is concurrent. Will be true when a job is rolling out new job executions or canceling previously created executions, otherwise false.

            
      
    
      

      - **nextToken** *(string) --* 

        The token for the next set of results, or **null** if there are no additional results.

        
  
  **Exceptions**
  
  *   :py:class:`IoT.Client.exceptions.InvalidRequestException`

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

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

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

  