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

Deleting Instances in Batches

This API is an out-of-date version and may not be maintained in the future. Please use the API described in Batch Deleting Instances.

Function

This API is used to delete instances in batches.

Deleting an instance will delete the data in the instance without any backup. Exercise caution when performing this operation.

URI

POST /v1.0/{project_id}/instances/action

Table 1 describes the parameter.

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Indicates the ID of a project.

Request

Request

Table 2 describes the request parameters.

Table 2 Parameter description

Parameter

Type

Mandatory

Description

action

String

Yes

Indicates the operation to be performed on instances. The value of this parameter can be delete.

instances

Array

Yes

Indicates the list of instance IDs.

allFailure

String

No

Indicates whether to delete instances that fail to be created in batches.

If this parameter is set to true, all instances that fail to be created are deleted. In this case, the instances parameter in the request can be empty.

Example request

Deleting instances in batches:

{ 
    "action" : "delete", 
    "instances" : ["54602a9d-5e22-4239-9123-77e350df4a34", "7166cdea-dbad-4d79-9610-7163e6f8b640"] 
}

Deleting all instances that fail to be created:

{ 
    "action" : "delete", 
    "allFailure" : "true"
}

Response

Response parameters

When action is set to delete, allFailure is set to true, and an empty response is returned, the instances are deleted successfully. Table 3 describes the parameters.

Table 3 Parameter description

Parameter

Type

Description

results

Array

Indicates the result of instance modification.

Table 4 results parameter description

Parameter

Type

Description

instance

String

Indicates the instance ID.

result

String

Indicates an operation result, which can be success or failed

Example response

{ 
    "results": [ 
        { 
            "result": "success", 
            "instance": "afc90a2a-a02c-4cba-94d5-58dfa9ad1e0d" 
        }, 
        { 
            "result": "success", 
            "instance": "67fc5f8d-3986-4f02-bb75-4075a23112de" 
        } 
    ] 
}

Status Code

Table 5 describes the status code of successful operations. For details about other status codes, see Status Code.

Table 5 Status code

Status Code

Description

200

The instance is deleted successfully.