Querying Message Templates

Function

This API is used to query the message template list.

URI

GET /v2/{project_id}/{domain_id}/lts/events/notification/templates

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID.

Minimum: 32

Maximum: 32

domain_id

Yes

String

Account ID. For details about how to obtain an account ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID.

Minimum: 32

Maximum: 32

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token.

Minimum: 1000

Maximum: 2000

Content-Type

Yes

String

Set this parameter to application/json;charset=UTF-8.

Minimum: 30

Maximum: 30

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

results

Array of NotificationTemplate objects

Template array.

Table 4 NotificationTemplate

Parameter

Type

Description

name

String

Notification rule name.

type

Array of strings

Notification method.

desc

String

Template description.

source

String

Template source.

locale

String

Language.

templates

Array of SubTemplateResBody objects

Template body, which is an array.

create_time

Long

Creation time (timestamp in milliseconds).

modify_time

Long

Update time (timestamp in milliseconds).

project_id

String

Project ID. For details about how to obtain a project ID, see Obtaining the Account ID, Project ID, Log Group ID, and Log Stream ID.

Table 5 SubTemplateResBody

Parameter

Type

Description

sub_type

String

Template subtype, for example, sms or email.

content

String

Sub-template body. A variable following a dollar symbol ($) can only be one of the following variables. The supported variables vary according to alarm types (keyword or SQL).

topic

String

Email subject. This parameter is valid only when sub_type is set to email.

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Querying a message template

GET https://{endpoint}/v2/{project_id}/{domain_id}/lts/events/notification/templates

/v2/{project_id}/{domain_id}/lts/events/notification/templates

Example Responses

Status code: 200

The request is successful.

{
  "results" : [ {
    "create_time" : 1701352010150,
    "desc" : "This is the email test mode.",
    "locale" : "en-us",
    "modify_time" : 1701352010150,
    "name" : "15nWzUsOHA",
    "project_id" : "2a473356cca5487f8373be891bffc1cf",
    "source" : "LTS",
    "templates" : [ {
      "content" : "\"This is an email test template.\"",
      "sub_type" : "email"
    } ],
    "type" : [ "" ]
  }, {
    "create_time" : 1702021411612,
    "desc" : "This is the SMS test mode.",
    "locale" : "en-us",
    "modify_time" : 1702021411612,
    "name" : "RZ2ObeluNN",
    "project_id" : "2a473356cca5487f8373be891bffc1cf",
    "source" : "LTS",
    "templates" : [ {
      "content" : "\"This is an SMS test template.\"",
      "sub_type" : "sms"
    } ],
    "type" : [ "" ]
  } ]
}

Status code: 500

The server has received the request but encountered an internal error.

{
  "error_code" : "LTS.2017",
  "error_msg" : "Find Alarm rule failed."
}

Status Codes

Status Code

Description

200

The request is successful.

500

The server has received the request but encountered an internal error.

Error Codes

See Error Codes.