更新时间:2022-02-21 GMT+08:00

查询消息模板列表

功能介绍

  • 接口名称

    ListMessageTemplates

  • 功能描述

    分页查询模板列表,模板列表按照创建时间进行升序排列。分页查询可以指定offset以及limit。如果不存在模板,则返回空列表。额外的查询参数分别有message_template_name和protocol。

模板列表只能查询模板概要信息,查询模板内容请参考查询消息模板详情

URI

  • URI格式

    GET /v2/{project_id}/notifications/message_template?offset={offset}&limit={limit}&message_template_name={message_template_name}&protocol={protocol}

  • 参数说明

    名称

    是否必选

    参数类型

    说明

    project_id

    String

    项目ID

    获取项目ID请参考获取项目ID

    offset

    Integer

    偏移量

    偏移量为一个大于0小于资源总个数的整数,表示查询该偏移量后面的所有的资源数,默认值为0。

    limit

    Integer

    • 取值范围:1~100

      取值一般为10,20,50

    • 功能说明:每页返回的资源个数。

    默认值为100。

    message_template_name

    String

    模板的名称。

    只能包含大写字母、小写字母、数字、-和_,且必须由大写字母、小写字母或数字开头,长度在1到64个字符之间。

    protocol

    String

    模板支持的协议类型。

    目前支持的协议包括:

    • “email”:邮件传输协议。
    • “default”
    • “sms”:短信传输协议。
    • “dms”:DMS传输协议。
    • “http”、“https”:HTTP/HTTPS传输协议。

请求消息

请求样例
GET https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template?offset=0&limit=2&message_template_name=test1&protocol=email

响应消息

  • 要素说明

    名称

    参数类型

    说明

    request_id

    String

    请求的唯一标识ID。

    message_template_count

    String

    返回的模板个数。

    message_templates

    Message_template结构体数组

    请参见表1

    表1 Message_template结构体

    名称

    参数类型

    说明

    message_template_id

    String

    模板ID

    message_template_name

    String

    模板名称

    protocol

    String

    模板协议类型

    目前支持的协议包括:

    • “email”:邮件传输协议。
    • “default”
    • “sms”:短信传输协议。
    • “dms”:DMS传输协议。
    • “http”、“https”:HTTP/HTTPS传输协议。

    tag_names

    String数组

    模板tag列表

    create_time

    String

    模板创建时间

    时间格式为UTC时间,YYYY-MM-DDTHH:MM:SSZ

    update_time

    String

    模板最后更新时间

    时间格式为UTC时间,YYYY-MM-DDTHH:MM:SSZ

  • 响应样例
    {
        "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
    }

返回值

请参考返回值

错误码

请参考错误码说明