Querying Subscriptions
Function
This API is used to query the list of all subscriptions by page. The list is sorted by subscription adding time in ascending order. You can specify offset and limit. If no subscription has been added to the topic, an empty list is returned.
URI
GET /v2/{project_id}/notifications/subscriptions
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the project ID.For details about how to obtain the project ID, see Obtaining the Project ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
offset |
No |
Integer |
Specifies the offset. If the offset is an integer greater than 0 but less than the number of resources, all resources in excess of this offset will be queried. The default offset is 0. Default: 0 |
limit |
No |
Integer |
Specifies the maximum number of records in each query. The number ranges from 1 to 100 and is generally 10, 20, or 50. Specifies the number of resources returned on each page. The default number is 100. Default: 100 |
protocol |
No |
String |
Specifies the protocol name. The enumerated values are http, https, sms, email, functionstage, dms, and application. |
status |
No |
Integer |
Specifies the subscription status. 0: The subscription has not been confirmed. 1: The subscription has been confirmed. 2: Confirmation is not required. 3: The subscription was canceled. 4: The subscription was deleted. |
endpoint |
No |
String |
Specifies the subscription endpoint. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies a user token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID, which is unique. |
subscription_count |
Integer |
Specifies the number of subscriptions. |
subscriptions |
Array of ListSubscriptionsItem objects |
Specifies the subscription structure. |
Parameter |
Type |
Description |
---|---|---|
topic_urn |
String |
Specifies the resource identifier of the topic, which is unique. |
protocol |
String |
Specifies the subscription protocol. (Different protocols indicate different types of endpoints to receive messages.) The following protocols are supported: default email: The endpoints are email addresses. sms: The endpoints are phone numbers. functionstage: FunctionGraph (function) transmission protocol. The endpoints are functions. http and https: The endpoints are URLs. |
subscription_urn |
String |
Specifies the resource identifier of a subscription, which is unique. |
owner |
String |
Specifies the project ID of the topic creator. |
endpoint |
String |
Specifies the message receiving endpoint. |
remark |
String |
Specifies the remarks. |
status |
Integer |
0 indicates that the subscription is not confirmed. 1 indicates that the subscription is confirmed. 3 indicates that the subscription is canceled. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID, which is unique. |
code |
String |
Specifies the error code. |
message |
String |
Describes the error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID, which is unique. |
code |
String |
Specifies the error code. |
message |
String |
Describes the error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID, which is unique. |
code |
String |
Specifies the error code. |
message |
String |
Describes the error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
request_id |
String |
Specifies the request ID, which is unique. |
code |
String |
Specifies the error code. |
message |
String |
Describes the error message. |
Example Requests
Querying subscriptions
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/subscriptions?offset=0&limit=2 null
Example Responses
Status code: 200
OK
{ "request_id" : "6a63a18b8bab40ffb71ebd9cb80d0085", "subscription_count" : 2, "subscriptions" : [ { "topic_urn" : "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol" : "sms", "subscription_urn" : "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:2e778e84408e44058e6cbc6d3c377837", "owner" : "762bdb3251034f268af0e395c53ea09b", "endpoint" : "xxxxxxxxxxx", "remark" : "", "status" : 0 }, { "topic_urn" : "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1", "protocol" : "email", "subscription_urn" : "urn:smn:regionId:762bdb3251034f268af0e395c53ea09b:test_topic_v1:a2d52a9f5c3b47f48c3fafb177a58796", "owner" : "762bdb3251034f268af0e395c53ea09b", "endpoint" : "xx@xx.com", "remark" : "", "status" : 0 } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
403 |
Unauthorized |
404 |
Not Found |
500 |
Internal Server Error |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.