Files
doc-exports/docs/smn/api-ref/en-us_topic_0036016755.html
2025-12-11 08:04:34 +00:00

17 KiB
Raw Blame History

Querying Topics

Description

  • API name

    ListTopics

  • Function

    Query the topics by page. The topics are sorted by the creation time in descending order. When querying the topics by page, you can specify offset and limit. If no topic has been created, an empty list is returned.

URI

  • URI format

    GET /v2/{project_id}/notifications/topics

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    See Obtaining a Project ID.

    offset

    No

    Integer

    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.

    limit

    No

    Integer

    The maximum number of records return on each page

    Value range: 1100

    Common values: 10, 20, and 50

    Default value: 100

    topic_id

    No

    String

    The ID of the topic to be searched for, which is fully matched

Request

Example request
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/topics?offset=0&limit=100

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID, which is unique

    topic_count

    Integer

    Number of topics in your account

    NOTE:

    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 Table 1 objects

    Topic structure array

    Table 1 Topic structure

    Parameter

    Type

    Description

    topic_urn

    String

    Resource identifier of a topic, which is unique

    name

    String

    Name of the topic

    display_name

    String

    Topic display name, which is presented as the name of the email sender in email messages

    push_policy

    Integer

    Message push policy

    • 0: Failed messages will be saved in message queues.
    • 1: Failed messages will be discarded.

    enterprise_project_id

    String

    Enterprise project ID

    topic_id

    String

    Topic ID

    create_time

    String

    The time when the topic was created

    The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

    update_time

    String

    The time when the topic was updated

    The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

  • Example response
    {
        "request_id": "70bb40bef50e4a14b116a5a527fd7432", 
        "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"
                "topic_id" : "84698185946d44d08431aa441d8e2cf2"
                "create_time": "2016-08-01T02:16:38Z",
                "update_time": "2016-08-01T02:16:38Z"
            }
        ]
    }

Returned Value

See Returned Value.

Error Codes

See Error Codes.