Batch Restarting or Deleting Instances
Function
This API is used to restart or delete instances in batches.
When an instance is being restarted, message retrieval and creation requests from clients will be rejected.
Deleting an instance will delete the data in the instance without any backup. Exercise caution when performing this operation.
Debugging
You can use API Explorer to debug this API.
URI
POST /v2/{project_id}/instances/action
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project ID. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
instances |
No |
Array of strings |
List of instance IDs. |
|
action |
Yes |
String |
Operation to be performed on instances. The value can be restart or delete. |
|
all_failure |
No |
String |
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. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
results |
Array of results objects |
Result of instance modification. |
Example Requests
-
Restarting instances in batches.
POST https://{endpoint}/v2/{project_id}/instances/action { "action" : "restart", "instances" : [ "54602a9d-5e22-4239-9123-77e350df4a34", "7166cdea-dbad-4d79-9610-7163e6f8b640" ] } -
Deleting instances in batches.
POST https://{endpoint}/v2/{project_id}/instances/action { "action" : "delete", "instances" : [ "54602a9d-5e22-4239-9123-77e350df4a34", "7166cdea-dbad-4d79-9610-7163e6f8b640" ] } -
Deleting all instances that fail to be created.
POST https://{endpoint}/v2/{project_id}/instances/action { "action" : "delete", "allFailure" : true }
Example Responses
Status code: 200
The instances are restarted or deleted successfully.
{
"results" : [ {
"result" : "success",
"instance" : "019cacb7-4ff0-4d3c-9f33-f5f7b7fdc0e6"
} ]
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
The instances are restarted or deleted successfully. |
Error Codes
See Error Codes.
Last Article: Modifying Instance Information
Next Article: Instance Management
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.