Querying Topics
Function
This API is used to query topics by page. The topics are sorted by the creation time in descending order. You can specify offset and limit. If no topic has been created, an empty list is returned.
URI
GET /v2/{project_id}/notifications/topics
|
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 |
|
enterprise_project_id |
No |
String |
Specifies the enterprise project ID. The default enterprise project ID is 0. The default ID is 0 |
|
name |
No |
String |
Specifies the name of the topic to be searched for, which is fully matched. |
|
fuzzy_name |
No |
String |
Specifies the name of the topic to be searched for, which is fuzzy match. startwith() is used for the fuzzy match. |
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. |
|
topic_count |
Integer |
Specifies the number of returned topics. No matter what you have set for offset and limit in the request, this API always returns the total number of topics in your account. |
|
topics |
Array of ListTopicsItem objects |
Specifies the topic structure array. |
|
Parameter |
Type |
Description |
|---|---|---|
|
topic_urn |
String |
Specifies the resource identifier of the topic, which is unique. |
|
name |
String |
Specifies the topic name. |
|
display_name |
String |
Specifies the topic display name, which is presented as the name of the email sender in email messages. |
|
push_policy |
Integer |
Specifies the message push policy. 0 indicates that the message sending fails and the message is cached in the queue. 1 indicates that the failed message is discarded. |
|
enterprise_project_id |
String |
Specifies the enterprise project ID. |
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 topics
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics?offset=0&limit=100
null
Example Responses
Status code: 200
OK
{
"request_id" : "6a63a18b8bab40ffb71ebd9cb80d0085",
"topic_count" : 1,
"topics" : [ {
"topic_urn" : "urn:smn:regionId:8bad8a40e0f7462f8c1676e3f93a8183:test_topic_v2",
"display_name" : "testtest",
"name" : "test_topic_v1",
"push_policy" : 0,
"enterprise_project_id" : "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: Updating a Topic
Next Article: Querying Details About a Topic
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.