Updated on 2024-01-17 GMT+08:00

Querying an SMS Template

Function

This API is used to query information about a created template.

URI

GET /v2/{project_id}/msgsms/templates

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining Account, User, and Project Information.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

app_key

No

String

Application key.

app_name

No

String

Application name.

end_time

No

String

End time.

flow_status

No

String

Process status.

  • Adopted: approved
  • Reviewing: under review
  • Reject: rejected

has_variable

No

String

Whether the template contains variables.

limit

No

Integer

Quantity. The default value is 10.

offset

No

Integer

Offset.

region

No

String

Region.

sign_name

No

String

Signature name.

sort_dir

No

String

Sorting method.

  • desc: The query results are displayed in the descending order.
  • asc: The query results are displayed in ascending order.

sort_key

No

String

Sorting field. Only create_time is supported.

start_time

No

String

Start time.

template_id

No

String

Template ID.

template_name

No

String

Template name.

template_type

No

String

Template type.

  • VERIFY_CODE_TYPE: verification code
  • NOTIFY_TYPE: notification

    For international SMSs, the value is fixed to NOTIFY_TYPE.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Request body parameter type. This parameter must be set to application/json.

X-Auth-Token

Yes

String

User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is a token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

results

Array of SmsTemplateResp

Query result.

total

Long

Total number.

Table 5 SmsTemplateResp parameters

Parameter

Description

id

Primary key ID of the template. It is unique and is used to obtain, modify, and delete the template and query template variables.

template_name

Template name.

template_type

Template type.

template_content

Template content.

template_id

Template ID.

app_key

Application key.

sign_id

Signature ID.

create_time

Creation time.

customer_id

Customer ID.

has_variable

Whether the template contains variables.

flow_status

Process status.

status

Template statuses:

  • Test
  • Normal

universal_template

Whether the template is a general template.

review_desc

Review description.

country_name

Country or region.

Request Example

GET /v2/845ada5bc7444f1295cd517af0123da1/msgsms/templates?template_name=auto_test789 
Host: 100.85.***.***:30300
Content-Type: application/json
X-Auth-Token: ****

Response Example

{
    "results": [
        {
            "create_time": "2022-08-12 07:40:36",
            "customer_id": "******c55c3c4526b2ed7a0213bc9871",
            "tenant": {
                "customer_id": "******c55c3c4526b2ed7a0213bc9871",
                "customer_name": "****05",
                "enterprise_name": "Huawei Technologies Co., Ltd."
            },
            "id": "******27-37eb-4229-bee9-0eba4d8a897f",
            "template_type": "NOTIFY_TYPE",
            "template_name": "auto_test789",
            "app_name": "auto_test7890",
            "app_key": "******3baZf4c856O4Qrbqvui3K2",
            "sign_id": "******b9-4141-4e2d-9838-14889c32a4bf",
            "template_content": "Test",
            "has_variable": "No",
            "flow_status": "Reviewing",
            "status": "Normal",
            "universal_template": 0,
            "region": "cn",
            "brackets": "GB",
            "site": "cn",
            "urge_status": "NO",
            "is_support_multiomp": false,
            "country_name": ""
        }
    ],
    "total": 1
}

Returned Values

Returned Value

Description

200

OK

401

Unauthorized

403

Forbidden

404

Not Found

500

System error