doc-exports/docs/smn/api-ref/en-us_topic_0036017300.html
Zaoxu, Li 152a7d9381 SMN API DOC
Reviewed-by: Bobkova, Natalia <natalia.bobkova@t-systems.com>
Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com>
Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
2024-06-20 15:01:38 +00:00

11 KiB

Creating a Topic

Description

  • API name

    CreateTopic

  • Function

    Create a topic. Each user can create 3,000 topics at most. In the high-concurrent scenario, a user may create a few topics more than 3,000.

    The API is idempotent. It returns a successful result after creating a topic. If a topic of the same name already exists, the status code is 200. Otherwise, the status code is 201.

URI

  • URI format

    POST /v2/{project_id}/notifications/topics

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    See Obtaining a Project ID.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Name of the topic

    Enter 1 to 255 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. The topic name must start with a letter or digit.

    display_name

    Yes

    String

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

    The display name cannot exceed 192 bytes.

    display_name is left blank by default.

  • Example request
    POST https://{SMN_Endpoint}/v2/{project_id}/notifications/topics
    {
        "name": "test_topic_v2",
        "display_name": "testtest"
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID, which is unique

    topic_urn

    String

    Unique resource ID of a topic. You can obtain it by referring to Querying Topics.

  • Example response
    {
        "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085",
        "topic_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2"
    }

Returned Value

See Returned Value.

Error Codes

See Error Codes.