Updated on 2024-10-25 GMT+08:00

Deleting SMS Templates in Batches

Function

This API is used to delete templates in batches.

URI

POST /v2/{project_id}/msgsms/templates/batch-delete

Table 1 URI parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

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

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

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.

Minimum length: 1

Maximum length: 32,768

Content-Type

Yes

String

Request body parameter type. This parameter must be set to application/json;charset=utf8.

Default value: application/json;charset=utf8

Minimum length: 1

Maximum length: 255

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

ids

No

Array of strings

Template primary key ID set.

Minimum length: 1

Maximum length: 64

Array length: 1 to 50

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

success_count

Integer

Number of successfully deleted records.

Minimum value: 0

Maximum value: 50

success_ids

Array of strings

Set of primary key IDs of templates that are successfully deleted.

Minimum length: 1

Maximum length: 64

Array length: 0 to 50

failed_count

Integer

Number of records that fail to be deleted.

Minimum value: 0

Maximum value: 50

failed_template_list

Array of SmsTemplateDeleteErrorInfo objects

Information list of template deletion failure.

Array length: 0 to 50

Table 5 SmsTemplateDeleteErrorInfo

Parameter

Type

Description

id

String

Primary key ID of the template.

Minimum length: 1

Maximum length: 64

error_msg

String

Information of template deletion failure.

Minimum length: 1

Maximum length: 512

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum length: 8

Maximum length: 36

error_msg

String

Error message.

Minimum length: 1

Maximum length: 512

error_detail

String

Description.

Minimum length: 1

Maximum length: 512

Request Example

Delete templates whose primary key IDs are ******27-37eb-4229-bee9-0eba4d8a897f and ******fe-8c9d-4cd2-9402-cd2fef488782 in batches.

POST https://{Endpoint}/v2/{project_id}/msgsms/templates/batch-delete

{
  "ids" : [ "******27-37eb-4229-bee9-0eba4d8a897f", "******fe-8c9d-4cd2-9402-cd2fef488782" ]
}

Response Example

Status code: 200

OK

{
  "success_count" : 1,
  "success_ids" : [ "******27-37eb-4229-bee9-0eba4d8a897f" ],
  "failed_count" : 1,
  "failed_template_list" : [ {
    "id" : "******fe-8c9d-4cd2-9402-cd2fef488782",
    "error_msg" : "Message Template Info does not EXIST"
  } ]
}

Returned Values

Status Code

Description

200

OK

400

Error response

401

Unauthorized

403

Forbidden

404

Not Found