• Simple Message Notification

smn
  1. Help Center
  2. Simple Message Notification
  3. API Reference
  4. APIs
  5. Template Operation
  6. Querying Message Templates

Querying Message Templates

Description

  • API name

    ListMessageTemplates

  • Function

    Query the template list by page. The list is sorted by the template creation time in ascending order. If no template has been created, an empty list is returned. The parameters message_template_name and protocol are added.

NOTE:

The template list provides only brief information. To query the template details, see section Querying the Message Template Details.

URI

  • URI format

    GET /v2/{project_id}/notifications/message_template?offset=0&limit=2

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

    offset

    No

    int

    Start page of the list

    The value must be greater than or equal to 0.

    limit

    No

    int

    Maximum number of items returned at a time

    The value ranges from 1 to 100.

    message_template_name

    No

    String

    Template name

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

    protocol

    No

    String

    Protocol supported by the template

    NOTE:

    Currently, email, sms, dms, http, and https are supported.

Request

Request example
GET /v2/{project_id}/notifications/message_template?offset=0&limit=2&message_template_name=test1&protocol=email

Response

  • Parameter description

    Parameter

    Type

    Description

    request_id

    String

    Request ID, which is unique

    message_template_count

    int

    Number of returned templates

    message_templates

    Message template structure array

    For details, see section Message Template Structure.

  • Response example
    {
        "message_templates":[
            {
                "message_template_name":"confirm_message",
                "update_time":"2016-08-02T08:22:18Z",
                "create_time":"2016-08-02T08:22:18Z",
                
                "tag_names":[
                    "topic_urn"
                ],
                "message_template_id":"79227dfdf88d4e52a1820ca1eb411635"
            },
            {
                "message_template_name":"confirm_message",
                "protocol":"email",
                "update_time":"2016-08-02T08:22:19Z",
                "create_time":"2016-08-02T08:22:19Z",
                
                "tag_names":[
                    "topic_id"
                ],
                "message_template_id":"ecf63465804a4b10a0573980be78ffba"
            },
            {
                "message_template_name":"confirm_message",
                "protocol":"https",
                "update_time":"2016-08-02T08:22:20Z",
                "create_time":"2016-08-02T08:22:20Z",
                
                "tag_names":[
                    "topic_id"
                ],
                "message_template_id":"57ba8dcecda844878c5dd5815b65d10f"
            }
        ],
        "request_id":"ce7f2f7343224f8c9597b05a9a0bcc2e",
        "message_template_count":3
    }

Returned Value

See section Returned Value.

Error Code

See section Error Code.