Get subscription list

Last updated: 2020-02-26 15:56:04

Interface description

This API (ListSubscriptionByTopic) is used to list subscriptions under a certain topic of a user, and the data can be obtained by page.

  • Domain name requested by public network API: https://cmq-topic-{$region}.api.qcloud.com
  • Domain name requested by private network API: http://cmq-topic-{$region}.api.tencentyun.com

The above {$region} in the domain name needs to be replaced with a specific region : gz (Guangzhou), sh (Shanghai), bj (Beijing), shjr (Shanghai Financial), szjr (Shenzhen Financial), hk (China Hong Kong), cd (Chengdu), ca (North American), usw (Maxi), sg (Singapore). The region value in the common parameters should be consistent with the region value of the domain name. If there is any inconsistency, the request will be sent to the region specified by the domain name region based on the region value of the domain name.

At any time (including during internal testing), if the public network downstream Traffic is generated by using a public network domain name, Traffic and cost will be charged. Therefore, users of the service on Tencent Cloud are strongly recommended to use it. Private network Domain name, private network will not produce Traffic cost.

Input Parameter

The following request parameter list only lists the API request parameters. For other parameters, please see Common Request Parameters page.

Parameter name Required Type Description
TopicName Yes String Topic's name is unique under the same account in a single region. The name of topic is a string of no more than 64 characters, which must begin with a letter, and the rest can contain letters, numbers and underscores (-).
SearchWord No String Used to filter the subscription list, Backend Background uses fuzzy matching to return the subscription list that meets the criteria. If this parameter is left empty, all subscriptions under the account will be returned by default.
Offset No Int This page gets the starting position of the subscription list when paging. If Enter reaches this value, Enter limit must also be required. When this value defaults, Backend Background takes the default value of 0. Value range: 0-1000.
Limit No Int This page gets the number of subscriptions when paging. The value range of this parameter is 0-100. If the parameter is not passed, it defaults to 20.

The meanings of offset and limit are the same as those of offset and limit of SQL.

Output Parameter

Parameter name Type Description
Code Int Please see [Error Codes
](https://intl.cloud.tencent.com/document/product/406/5903) Message String
RequestId String Request ID generated by the server. When an internal error occurs on the server, the user can submit this ID to Backend Background to locate the problem.
TotalCount Int The total number of topic returned by this request under the user account, rather than the number of topic obtained on this page after paging.
SubscriptionList Array Topic list information, each element represents a topic information.

SubscriptionList is defined as follows:

Parameter name Type Description
SubscriptionId String Subscribe to ID. Subscription ID is used when pulling monitoring data.
SubscriptionName String The subscription name is unique under the same topic of the same account in a single region. The subscription name is a string of no more than 64 characters, must begin with a letter, and the rest can contain letters, numbers, and dashes (-).
Protocol String Protocol, who subscribes to, currently supports two kinds of Protocol: HTTP and queue. With HTTP Protocol, users need to build their own Web Server to accept messages. Using queue, messages will be automatically pushed to CMQ queue, users can pull messages Concurrence.
Endpoint String The endpoint, that receives the notification is distinguished according to Protocol protocol: for HTTP,endpoint, you must use http:// At the beginning, host can be a domain name or IP;. Enter queueName for queue,.

Example

Enter:

 https://domain/v2/index.php?Action=ListSubscriptionByTopic
 &searchWord=abc
 &<Common request parameters>

Output:

{
    "code":0,
    "message":"",
    "requestId":"14534664555",
    "totalCount":2,
    "subscriptionList":[
        {
            "subscriptionId":"subsc-sdkfl",
            "subscriptionName":"test-sub2",
            "protocol":"http",
            "endpoint":"http://testhost/testpath"
        },
        {
            "subscriptionId":"subsc-34lasdk",
            "subscriptionName":"test-sub1",
            "protocol":"queue",
            "endpoint":"test-queue-name"
        }
    ]
}