全部產品
Search
文件中心

:GetSubscriptionAttributes

更新時間:Jan 24, 2025

調用GetSubscriptionAttributes介面擷取Subscription的屬性。

授權資訊

預設僅限阿里雲帳號使用本介面,RAM使用者只有在被授予了相關API操作許可權後方可使用。本介面的授權資訊如下表所示。更多資訊,請參見授權策略和樣本

NameValue
APIGetSubscriptionAttributes
RAM授權操作mns:GetSubscriptionAttributes
資源acs:mns:$region:$accountid:/topics/$topicName/subscriptions/$subscriptionName

請求訊息

請求訊息由請求行、HTTP頭和訊息體三部分組成:

  • 請求行

    GET /topics/$TopicName/subscriptions/$SubscriptionName HTTP/1.1

  • 特有Request Header

    無。

  • Request Body

    無。

返回訊息

返回訊息由返回狀態行、HTTP頭和訊息三部分組成:

  • HTTP Status Code

    HTTP/1.1 200 OK

  • 特有Response Header

    無。

  • Response Body
    參數名稱類型樣本值描述
    SubscriptionNameStringMySubscriptionSubscription的名稱。
    SubscriberStringMyQueueSubscription訂閱者的AccountId。
    TopicOwnerString123456789098****Subscription訂閱的主題所有者的AccountId。
    TopicNameStringMyTopicSubscription訂閱的主題名稱。
    EndpointStringhttp://example.com訂閱的終端地址。
    NotifyStrategyBooleanBACKOFF_RETRY向Endpoint推送訊息錯誤時的重試策略。
    取值說明如下:
    • BACKOFF_RETRY:退避重試。
    • EXPONENTIAL_DECAY_RETRY:指數衰減重試。
    重試策略的具體描述,請參見NotifyStrategy
    NotifyContentFormatBooleanXML向Endpoint推送的訊息內容格式。
    取值說明如下:
    • XML
    • JSON
    • SIMPLIFIED
    訊息格式的具體描述,請參見NotifyContentFormat
    FilterTagStringimportant描述了該訂閱中訊息過濾的標籤(僅標籤一致的訊息才會被推送)。
    CreateTimeLong1449554806Subscription的建立時間,從1970-01-01 00:00:00到現在的。
    LastModifyTimeLong1449554962最近一次修改Subscription屬性資訊的時間,從1970-01-01 00:00:00到現在的秒值。

樣本

請求樣本:

GET /topics/$TopicName/subscriptions/$SubscriptionName HTTP/1.1
Host: $AccountId.mns.cn-hangzhou.aliyuncs.com
Date: Tue, 08 Dec 2015 06:09:58 GMT
Authorization: MNS 15B4D3461F177624206A:GvaApggLQfMu6B6W5sbF6HEj****
x-mns-version: 2015-06-06

返回樣本:

HTTP/1.1 200 OK
Content-Type=text/xml;utf-8
Content-Length:451
x-mns-request-id:56667436B2B71C9C1600****
x-mns-version: 2015-06-06

<?xml version="1.0" encoding="utf-8"?>
<Subscription xmlns="http://mns.aliyuncs.com/doc/v1">
    <CreateTime>1449554806</CreateTime>
    <Endpoint>http://example.com</Endpoint>
    <FilterTag>important</FilterTag>
    <LastModifyTime>1449554962</LastModifyTime>
    <NotifyContentFormat>XML</NotifyContentFormat>
    <NotifyStrategy>BACKOFF_RETRY</NotifyStrategy>
    <SubscriptionName>MySubscription</SubscriptionName>
    <Subscriber>MyQueue</Subscriber>
    <TopicName>MyTopic</TopicName>
    <TopicOwner>123456789098****</TopicOwner>
</Subscription>        

錯誤碼

錯誤碼錯誤資訊HTTP狀態代碼描述內容
SubscriptionNotExistThe subscription you provided does not exist.404訂閱不存在,請先建立訂閱。