Querying Subscriptions
Function
This API is used to query the list of all subscriptions by page. The list is sorted by the 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. |
|
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 after this offset will be queried. The default offset is 0. The default offset is 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, indicating the number of resources returned on each page. The default value is 100. Default value: 100 |
|
protocol |
No |
String |
Specifies the protocol name. Enumerated protocols: http, https, sms, email, functionstage, dms, and application. |
|
status |
No |
Integer |
Specifies the subscription status.
|
|
endpoint |
No |
String |
Specifies the subscription endpoint. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Specifies the user token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
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:
|
|
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 |
Specifies the subscription status.
|
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.
Last Article: Adding a Subscription
Next Article: Querying Subscriptions of a Specified Topic
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.