All Products
Search
Document Center

GetTopicAttributes

Last Updated: Oct 08, 2019

GetTopicAttributes

Description

This API is used to obtain the attributes of an existing topic. The returned attributes include the attributes that are configured during topic creation, as well as the message retention period and topic creation time.

Request

A request includes the following parts:

  • Request line

    GET /topics/$TopicName HTTP/1.1

  • Special request header

    None. For details, refer to Call method/Public parameters.

  • Request Body

    None

Response

  1. The response message includes three parts: return status line, HTTP header, and message body.
  • HTTP Status Code

    HTTP/1.1 200 OK

  • Special response header

    None. For details, refer to Call method/Public parameters.

  • Response Body

    The returned results are in the following XML format: <TopicAttributes>Attribute Element List</TopicAttributes>.

The attribute element list includes:

Parameter name Description
TopicName Name of a topic
CreateTime Time when a topic is created, defined as the number of seconds that have elapsed since 00:00:00, January 1, 1970
LastModifyTime Last modification time of topic attributes, defined as the number of seconds that have elapsed since 00:00:00, January 1, 1970
MaximumMessageSize Maximum body length of a message published to the topic, in the unit of bytes
MessageRetentionPeriod Maximum lifetime of a message in the topic, defined as the number of seconds that have elapsed since the message publishing time. After the time indicated by this parameter expires, the message will be deleted no matter whether it has been successfully pushed to a user.
MessageCount Number of messages in the topic
LoggingEnabled Whether to enable log management. “True” indicates that log management is enabled, whereas “False” indicates that log management is disabled.

Special error

Error code Error message Status code
TopicNotExist The topic you provided does not exist. 404

Request example:

  1. GET /topics/$TopicName HTTP/1.1
  2. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  3. Date: Tue, 08 Dec 2015 06:02:33 GMT
  4. x-mns-version: 2015-06-06
  5. Authorization:MNS 15B4D3461F177624206A:aVZgLZzVchjOtM1aecDQYFuj4Bo=

Response example:

  1. HTTP/1.1 200 OK
  2. Content-Type=text/xml;utf-8
  3. Content-Length:145
  4. x-mns-request-id:56667279B2B71C9C1600001D
  5. x-mns-version: 2015-06-06
  6. <?xml version="1.0" encoding="UTF-8"?>
  7. <Topic xmlns=http://mns.aliyuncs.com/doc/v1/”>
  8. <TopicName>$TopicName</TopicName>
  9. <CreateTime>1449554277</CreateTime >
  10. <LastModifyTime>1449554460</LastModifyTime>
  11. <MaximumMessageSize>65536</MaximumMessageSize>
  12. <MessageRetentionPeriod>86400</MessageRetentionPeriod>
  13. <MessageCount>0</MessageCount>
  14. <LoggingEnabled>True</LoggingEnabled>
  15. </Topic>