:doc:`IoTDataPlane <../../iot-data>` / Client / list_retained_messages

**********************
list_retained_messages
**********************



.. py:method:: IoTDataPlane.Client.list_retained_messages(**kwargs)

  

  Lists summary information about the retained messages stored for the account.

   

  This action returns only the topic names of the retained messages. It doesn't return any message payloads. Although this action doesn't return a message payload, it can still incur messaging costs.

   

  To get the message payload of a retained message, call `GetRetainedMessage <https://docs.aws.amazon.com/iot/latest/apireference/API_iotdata_GetRetainedMessage.html>`__ with the topic name of the retained message.

   

  Requires permission to access the `ListRetainedMessages <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html>`__ action.

   

  For more information about messaging costs, see `Amazon Web Services IoT Core pricing - Messaging <http://aws.amazon.com/iot-core/pricing/#Messaging>`__.

  

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


  **Request Syntax**
  ::

    response = client.list_retained_messages(
        nextToken='string',
        maxResults=123
    )
    
  :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 maxResults: integer
  :param maxResults: 

    The maximum number of results to return at one time.

    

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

    
    ::

      {
          'retainedTopics': [
              {
                  'topic': 'string',
                  'payloadSize': 123,
                  'qos': 123,
                  'lastModifiedTime': 123
              },
          ],
          'nextToken': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **retainedTopics** *(list) --* 

        A summary list the account's retained messages. The information returned doesn't include the message payloads of the retained messages.

        
        

        - *(dict) --* 

          Information about a single retained message.

          
          

          - **topic** *(string) --* 

            The topic name to which the retained message was published.

            
          

          - **payloadSize** *(integer) --* 

            The size of the retained message's payload in bytes.

            
          

          - **qos** *(integer) --* 

            The quality of service (QoS) level used to publish the retained message.

            
          

          - **lastModifiedTime** *(integer) --* 

            The Epoch date and time, in milliseconds, when the retained message was stored by IoT.

            
      
    
      

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

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

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

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

  
  *   :py:class:`IoTDataPlane.Client.exceptions.UnauthorizedException`

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

  
  *   :py:class:`IoTDataPlane.Client.exceptions.InternalFailureException`

  
  *   :py:class:`IoTDataPlane.Client.exceptions.MethodNotAllowedException`

  