Updated on 2024-08-29 GMT+08:00

Querying an SMN Topic

Function

This API is used to query an SMN topic.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/lts/notifications/topics

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

offset

Yes

Integer

Query cursor. Set the value to 0 in the first query. In subsequent queries, obtain the value from the response to the last request.

limit

Yes

Integer

Number of records on each page. The maximum value is 100.

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

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token.

Content-Type

Yes

String

Set this parameter to application/json;charset=UTF-8.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

request_id

topic_count

Integer

Number of topics.

topics

Array of Topics objects

Topic information.

Table 5 Topics

Parameter

Type

Description

name

String

Topic name.

topic_urn

String

Specifies the resource identifier of the topic, which is unique.

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.

Example Requests

Querying an SMN topic

POST https://{endpoint}/v2/{project_id}/lts/notifications/topics

/v2/{project_id}/lts/notifications/topics?offset={offset}&limit={limit} 

Example Responses

Status code: 200

The request is successful.

{
  "request_id" : "1",
  "topic_count" : 100,
  "topics" : [ {
    "name" : "huawei",
    "topic_urn" : "urn:smn:cn-north-7:{projectId}:fyy",
    "display_name" : "",
    "push_policy" : 0
  } ]
}

Status Codes

Status Code

Description

200

The request is successful.

Error Codes

See Error Codes.