Queries the parameters of a topic. The operation returns the parameters that were specified when the topic was created. The operation also returns the time when the topic was created and the maximum period for which a message can be retained in the topic.
Authorization
By default, only Alibaba Cloud accounts can call this operation. RAM users can call this operation only after these RAM users are granted related permissions. The following table describes the authorization information of this operation. For more information, see Permission policies and examples.
Item | Value |
---|---|
API operation | GetTopicAttributes |
Action | mns:GetTopicAttributes |
Resource | acs:mns:$region:$accountid:/topics/$topicName |
Request
A request consists of the following parts:
-
Request line
GET /topics/$TopicName HTTP/1.1
-
Operation-specific request headers
None.
-
Request body
None.
Response
A response consists of the following parts:
- HTTP status code
HTTP/1.1 200 OK
- Operation-specific response headers
None.
- Response body
The response body is in the XML format. Syntax:
<TopicAttributes>Attribute Element List</TopicAttributes>
.The response body contains the following parameters.
Parameter Type Example Description TopicName String demo-topic The name of the topic. CreateTime Long 1449554277 The time when the topic was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. LastModifyTime Long 1449554460 The time when the topic was last modified. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since the epoch time January 1, 1970, 00:00:00 UTC. MaximumMessageSize Integer 65536 The maximum size of a message body that can be sent to the topic. Unit: bytes. MessageRetentionPeriod Integer 86400 The maximum period for which a message can be retained in the topic. A message that is sent to the topic can be retained for a specified period. After the specified period ends, the message is deleted no matter whether it is pushed to the specified endpoints. Unit: seconds. MessageCount Integer 0 The number of messages in the topic. LoggingEnabled Boolean True Indicates whether the log management feature is enabled. Valid values: - True: The log management feature is enabled.
- False: The log management feature is disabled.
Examples
Sample requests
GET /topics/$TopicName HTTP/1.1
Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
Date: Tue, 08 Dec 2015 06:02:33 GMT
x-mns-version: 2015-06-06
Authorization:MNS 15B4D3461F177624206A:aVZgLZzVchjOtM1aecDQYFuj****
Sample success responses
HTTP/1.1 200 OK
Content-Type=text/xml;utf-8
Content-Length:145
x-mns-request-id:56667279B2B71C9C1600****
x-mns-version: 2015-06-06
<?xml version="1.0" encoding="UTF-8"?>
<Topic xmlns=http://mns.aliyuncs.com/doc/v1/”>
<TopicName>demo-topic</TopicName>
<CreateTime>1449554277</CreateTime >
<LastModifyTime>1449554460</LastModifyTime>
<MaximumMessageSize>65536</MaximumMessageSize>
<MessageRetentionPeriod>86400</MessageRetentionPeriod>
<MessageCount>0</MessageCount>
<LoggingEnabled>True</LoggingEnabled>
</Topic>
Error codes
Error code | Error message | HTTP status code | Description |
---|---|---|---|
TopicNotExist | The topic you provided does not exist. | 404 | The error message returned because the specified queue does not exist. Create a queue. |