• Simple Message Notification

smn
  1. Help Center
  2. Simple Message Notification
  3. API Reference
  4. APIs
  5. Topic Operations
  6. Creating a Topic

Creating a Topic

Description

  • API name

    CreateTopic

  • Function

    Create a topic. Each user can create a maximum of 3000 topics.

    The API is idempotent. It results 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

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    name

    Yes

    String

    Name of the topic to be created

    The topic name is a string of 1 to 255 characters. It must contain letters, digits, hyphens (-), and underscores (_), and must start with a letter or digit.

    display_name

    No

    String

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

    The display name cannot exceed 192 bytes.

  • Request example
    POST /v2/{project_id}/notifications/topics
    {
        "name": "test_topic_v2",
        "display_name": "testtest"
    }

Response

  • Parameter description

    Parameter

    Type

    Description

    Constraint

    request_id

    String

    Request ID, which is unique

    -

    topic_urn

    String

    Resource identifier of a topic, which is unique

    -

  • Response example
    {
        "request_id": "6a63a18b8bab40ffb71ebd9cb80d0085",
        "topic_urn": "urn:smn:regionId:f96188c7ccaf4ffba0c9aa149ab2bd57:test_topic_v2"
    }

Returned Value

See section Returned Value.

Error Code

See section Error Code.