:doc:`IoTAnalytics <../../iotanalytics>` / Client / sample_channel_data

*******************
sample_channel_data
*******************



.. py:method:: IoTAnalytics.Client.sample_channel_data(**kwargs)

  

  Retrieves a sample of messages from the specified channel ingested during the specified timeframe. Up to 10 messages can be retrieved.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/iotanalytics-2017-11-27/SampleChannelData>`_  


  **Request Syntax**
  ::

    response = client.sample_channel_data(
        channelName='string',
        maxMessages=123,
        startTime=datetime(2015, 1, 1),
        endTime=datetime(2015, 1, 1)
    )
    
  :type channelName: string
  :param channelName: **[REQUIRED]** 

    The name of the channel whose message samples are retrieved.

    

  
  :type maxMessages: integer
  :param maxMessages: 

    The number of sample messages to be retrieved. The limit is 10. The default is also 10.

    

  
  :type startTime: datetime
  :param startTime: 

    The start of the time window from which sample messages are retrieved.

    

  
  :type endTime: datetime
  :param endTime: 

    The end of the time window from which sample messages are retrieved.

    

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

    
    ::

      {
          'payloads': [
              b'bytes',
          ]
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **payloads** *(list) --* 

        The list of message samples. Each sample message is returned as a base64-encoded string.

        
        

        - *(bytes) --* 
    
  
  **Exceptions**
  
  *   :py:class:`IoTAnalytics.Client.exceptions.InvalidRequestException`

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

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

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

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

  