All Products
Search
Document Center

ListSubscriptionByTopic

Last Updated: Oct 08, 2019

ListSubscriptionByTopic

Description

This API is used to list the subscriptions to a topic. Querying by page is supported.

TIP:

If the total number of subscriptions 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/$TopicName/subscriptions HTTP/1.1

  • Special request header

Parameter name Description Required/Optional
x-mns-prefix Search for the subscription names starting with the specified prefix 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

For the other request headers, refer to Call Method/Public Parameters.

  • Request Body

    None

Response

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 Subscriptions element contains multiple Subscription elements, and each Subscription element contains the SubscriptionURL element indicating the URL of the subscription.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/$TopicName/subscriptions HTTP/1.1
  2. x-mns-ret-number:2
  3. Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
  4. Date: Tue, 08 Dec 2015 06:16:18 GMT
  5. Authorization: MNS 15B4D3461F177624206A:dXSLY5yGG8Ri5f26ZEmxMCq1CC4=
  6. x-mns-version: 2015-06-06

Response example:

  1. HTTP/1.1 200 OK
  2. x-mns-request-id:566675B2B2B71C9C16000033
  3. x-mns-version: 2015-06-06
  4. <?xml version="1.0" encoding="utf-8"?>
  5. <Subscriptions xmlns="http://mns.aliyuncs.com/doc/v1/">
  6. <Subscription>
  7. <SubscriptionURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/$TopicName/subscriptions/$SubscriptionName1</SubscriptionURL>
  8. </Subscription>
  9. <Subscription>
  10. <SubscriptionURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/$TopicName/subscriptions/$SubscriptionName2</SubscriptionURL>
  11. </Subscription>
  12. <NextMarker>OTczNjU4MTcvYmRwejd6NXluby8yNjg0Mi9+fn5FI1Rlc3RUb3BpYy0xI2JkcHo3ejV5bm8jVGVzdFN1Yi0zLzA=</NextMarker>
  13. </Subscriptions>