GetRetainedMessage
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 IoT Core
pricing - Messaging
Request Syntax
GET /retainedMessage/topic
HTTP/1.1
URI Request Parameters
The request uses the following URI parameters.
- topic
-
The topic name of the retained message to retrieve.
Required: Yes
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"lastModifiedTime": number,
"payload": blob,
"qos": number,
"topic": "string",
"userProperties": blob
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- lastModifiedTime
-
The Epoch date and time, in milliseconds, when the retained message was stored by Amazon IoT.
Type: Long
- payload
-
The Base64-encoded message payload of the retained message body.
Type: Base64-encoded binary data object
- qos
-
The quality of service (QoS) level used to publish the retained message.
Type: Integer
Valid Range: Minimum value of 0. Maximum value of 1.
- topic
-
The topic name to which the retained message was published.
Type: String
- userProperties
-
A base64-encoded JSON string that includes an array of JSON objects, or null if the retained message doesn't include any user properties.
The following example
userProperties
parameter is a JSON string that represents two user properties. Note that it will be base64-encoded:[{"deviceName": "alpha"}, {"deviceCnt": "45"}]
Type: Base64-encoded binary data object
Errors
- InternalFailureException
-
An unexpected error has occurred.
HTTP Status Code: 500
- InvalidRequestException
-
The request is not valid.
HTTP Status Code: 400
- MethodNotAllowedException
-
The specified combination of HTTP verb and URI is not supported.
HTTP Status Code: 405
- ResourceNotFoundException
-
The specified resource does not exist.
HTTP Status Code: 404
- ServiceUnavailableException
-
The service is temporarily unavailable.
HTTP Status Code: 503
- ThrottlingException
-
The rate exceeds the limit.
HTTP Status Code: 429
- UnauthorizedException
-
You are not authorized to perform this operation.
HTTP Status Code: 401
See Also
For more information about using this API in one of the language-specific Amazon SDKs, see the following: