Help Center/ Simple Message Notification/ API Reference/ APIs/ Templates/ Querying Details About a Message Template
Updated on 2024-09-06 GMT+08:00

Querying Details About a Message Template

Function

This API is used to query template details, including the template content.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/notifications/message_template/{message_template_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.For details about how to obtain the project ID, see Obtaining the Project ID.

message_template_id

Yes

String

Specifies the unique resource ID of a template. To obtain the ID, see Querying Message Templates.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies a user token.

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

message_template_id

String

Specifies the template ID.

message_template_name

String

Specifies the template name.

protocol

String

Specifies the protocol supported by the template.

The following protocols are supported:

default

email

sms

functionstage

http and https

tag_names

Array of strings

Specifies the variable list.

The variable name will be quoted in braces ({}) in the template. When you use a template to send messages, you can replace the variable with any content.

create_time

String

Specifies when the template was created. The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

update_time

String

Specifies the last time when the template was updated. The UTC time is in YYYY-MM-DDTHH:MM:SSZ format.

content

String

Specifies the template content.

request_id

String

Specifies the request ID, which is unique.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 403

Table 5 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

request_id

String

Specifies the request ID, which is unique.

code

String

Specifies the error code.

message

String

Describes the error message.

Example Requests

Querying details about a message template

GET https://{SMN_Endpoint}/v2/{project_id}/notifications/message_template/57ba8dcecda844878c5dd5815b65d10f

null

Example Responses

Status code: 200

OK

{
  "message_template_id" : "57ba8dcecda844878c5dd5815b65d10f",
  "message_template_name" : "confirm_message",
  "protocol" : "https",
  "tag_names" : [ "topic_id_id4" ],
  "create_time" : "2016-08-02T08:22:20Z",
  "update_time" : "2016-08-02T08:22:25Z",
  "content" : "(1/24)You are invited to subscribe to topic({topic_id_id4}). Click the following URL to confirm subscription:(If you do not want to subscribe to this topic, ignore this message.)",
  "request_id" : "ba79ca8f794f4f50985ce7b98a401b47"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

403

Unauthorized

404

Not Found

500

Internal Server Error

Error Codes

See Error Codes.