get_retained_message

get_retained_message(**kwargs)

Gets the details of a single retained message for the specified topic.

This action returns the message payload of the retained message, which can incur messaging costs. To list only the topic names of the retained messages, call ListRetainedMessages.

Requires permission to access the GetRetainedMessage action.

For more information about messaging costs, see Amazon Web Services IoT Core pricing - Messaging.

See also: AWS API Documentation

Request Syntax

response = client.get_retained_message(
    topic='string'
)
Parameters
topic (string) --

[REQUIRED]

The topic name of the retained message to retrieve.

Return type
dict
Returns
Response Syntax
{
    'topic': 'string',
    'payload': b'bytes',
    'qos': 123,
    'lastModifiedTime': 123
}

Response Structure

  • (dict) --

    The output from the GetRetainedMessage operation.

    • topic (string) --

      The topic name to which the retained message was published.

    • payload (bytes) --

      The Base64-encoded message payload of the retained message body.

    • 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.

Exceptions

  • IoTDataPlane.Client.exceptions.InvalidRequestException
  • IoTDataPlane.Client.exceptions.ResourceNotFoundException
  • IoTDataPlane.Client.exceptions.ThrottlingException
  • IoTDataPlane.Client.exceptions.UnauthorizedException
  • IoTDataPlane.Client.exceptions.ServiceUnavailableException
  • IoTDataPlane.Client.exceptions.InternalFailureException
  • IoTDataPlane.Client.exceptions.MethodNotAllowedException