Queries all subscriptions to a topic. The subscriptions are displayed by page.

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 ListSubscriptionByTopic
Action mns:ListSubscriptionByTopic
Resource acs:mns:$region:$accountid:/topics/$topicName/subscriptions

Description

If the total number of subscriptions exceeds the value of the x-mns-ret-number parameter that is specified in the request, the NextMarker parameter that indicates the start position of the next page is returned. When you send another request to query the remaining subscriptions, you must set the x-mns-marker parameter to the returned value of the NextMarker parameter.

Request

A request consists of the following parts:

  • Request line

    GET /topics/$TopicName/subscriptions HTTP/1.1

  • Operation-specific request headers
    Parameter Type Required Example Description
    x-mns-prefix String No topic The prefix of the subscriptions to be queried.
    x-mns-marker Integer No 10 The start position of the next page. You can retrieve the value of this parameter from the NextMarker parameter in the previous response.
    x-mns-ret-number Integer No 2 The maximum number of results that can be returned for a single request.

    Valid values: 1 to 1000.

    For more information about other request headers, see Common parameters.

  • 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. A list of subscriptions is returned and each subscription includes a subscription URL. If the total number of subscriptions exceeds the value of the x-mns-ret-number parameter, the NextMarker parameter that indicates the start position of the next page is returned.

Examples

Sample requests

GET /topics/$TopicName/subscriptions HTTP/1.1
x-mns-marker: 10
x-mns-ret-number:2
Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
Date: Tue, 08 Dec 2015 06:16:18 GMT
Authorization: MNS 15B4D3461F177624206A:dXSLY5yGG8Ri5f26ZEmxMCq1****
x-mns-version: 2015-06-06

Sample success responses

HTTP/1.1 200 OK
x-mns-request-id:566675B2B2B71C9C1600****
x-mns-version: 2015-06-06

<?xml version="1.0" encoding="utf-8"?>
<Subscriptions xmlns="http://mns.aliyuncs.com/doc/v1/">
    <Subscription>
        <SubscriptionURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/$TopicName/subscriptions/$SubscriptionName1</SubscriptionURL>
    </Subscription>
    <Subscription>
        <SubscriptionURL>http://$AccountId.mns.cn-hangzhou.aliyuncs.com/$TopicName/subscriptions/$SubscriptionName2</SubscriptionURL>
    </Subscription>
    <NextMarker>OTczNjU4MTcvYmRwejd6NXluby8yNjg0Mi9+fn5FI1Rlc3RUb3BpYy0xI2JkcHo3ejV5bm8jVGVzdFN1Yi0zLzA=</NextMarker>
</Subscriptions>