Updated on 2024-12-20 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.

Minimum: 32

Maximum: 32

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.

Minimum: 0

Maximum: 1024

limit

Yes

Integer

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

Minimum: 0

Maximum: 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.

Minimum: 1000

Maximum: 2000

Content-Type

Yes

String

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

Minimum: 30

Maximum: 30

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

request_id

Minimum: 1

Maximum: 64

topic_count

Integer

Number of topics.

Minimum: 0

Maximum: 1000

topics

Array of Topics objects

Topic information.

Table 5 Topics

Parameter

Type

Description

name

String

Topic name.

Minimum: 1

Maximum: 1024

topic_urn

String

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

Minimum: 1

Maximum: 1024

display_name

String

Specifies the topic display name, which is presented as the name of the email sender in email messages.

Minimum: 1

Maximum: 1024

push_policy

Integer

Specifies the message push policy.

Minimum: 1

Maximum: 1024

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.