All Products
Search
Document Center

ListTopic

Last Updated: Oct 08, 2019

ListTopic

Description

This API is used to list the topics of an account. Querying by page is supported. To acquire a list of topics based on a specific prefix, set the x-mns-prefix parameter when calling this API.

Tips:

If the total number of topics returned for the current request exceeds the x-mns-ret-number value, the returned XML results include NextMarker to indicate the starting position of the next page, and this value is assigned to the x-mns-marker parameter in the next request to display the next page.

Request

A request includes the following parts:

  • Request line

    GET /topics HTTP/1.1

  • Special request header

Parameter name Description Required/Optional
x-mns-marker Starting position of the next page, which is acquired from NextMarker on the previous page Optional
x-mns-ret-number Maximum number of subscriptions returned for a single request, which is an integer in the range of 1 to 1,000. The default value is 1,000. Optional
x-mns-prefix Search for the topic names starting with the specified prefix Optional
  1. For details about other parameters, 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 XML format. The top-layer Topics element contains multiple Topic elements, and each Topic element contains the TopicURL element indicating the URL of the topic.If the number of returned queues exceeds the x-mns-ret-number value, the NextMarker element is included to indicate the starting position of the next page.

Request example:

  1. GET /topics HTTP/1.1
  2. x-mns-ret-number:2
  3. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  4. Date: Tue, 08 Dec 2015 05:59:22 GMT
  5. Authorization: NS15B4D3461F177624206A:ytChIeJt2klpvFxGCgVsPNI015k=
  6. x-mns-version: 2015-06-06

Response example:

  1. HTTP/1.1 200 OK
  2. x-mns-request-id:566671BAB2B71C9C16000019
  3. x-mns-version: 2015-06-06
  4. <?xml version="1.0" encoding="utf-8"?>
  5. <Topics xmlns="http://mns.aliyuncs.com/doc/v1/">
  6. <Topic>
  7. <TopicURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/topics/$TopicName1</TopicURL>
  8. </Topic>
  9. <Topic>
  10. <TopicURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/topics/$TopicName2</TopicURL>
  11. </Topic>
  12. <NextMarker>OTczNjU4MTcvYmRwejd6NXluby8yNjg0Mi9UZXN0VG9waWMtMy8w</NextMarker>
  13. </Topics>