Help Center/ Cloud Eye/ API Reference/ API V2/ Resources in a Resource Group/ Batch Deleting Resources from a Resource Group
Updated on 2024-12-26 GMT+08:00

Batch Deleting Resources from a Resource Group

Function

This API is used to batch delete resources from a resource group whose type is Manual.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

POST /v2/{project_id}/resource-groups/{group_id}/resources/batch-delete

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

group_id

Yes

String

Specifies the resource group ID, which starts with rg and is followed by 22 characters, including letters and digits.

Minimum: 2

Maximum: 24

project_id

Yes

String

Specifies the tenant ID.

Minimum: 1

Maximum: 64

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token.

Minimum: 1

Maximum: 16384

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

resources

Yes

Array of Resource objects

Specifies the resource information.

Array Length: 1 - 1000

Table 4 Resource

Parameter

Mandatory

Type

Description

namespace

Yes

String

Specifies the namespace of a service. For details about the namespace of each service, see Namespace.

dimensions

Yes

Array of Dimension objects

Specifies the resource dimension information.

Array Length: 1 - 4

Table 5 Dimension

Parameter

Mandatory

Type

Description

name

Yes

String

Specifies the dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Services Interconnected with Cloud Eye.

Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$

value

Yes

String

Specifies the value of a resource dimension, which is the resource ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-|\.)*)|\*){1,256}$

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

succeed_count

Integer

Specifies the number of resources that were successfully deleted.

Minimum: 0

Maximum: 1000

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Status code: 404

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Status code: 500

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Specifies the status codes customized by each cloud service when a request error occurs.

Minimum: 0

Maximum: 256

error_msg

String

Specifies the request error message.

Minimum: 0

Maximum: 256

request_id

String

Specifies the request ID.

Minimum: 0

Maximum: 256

Example Requests

Batch Deleting Resources from a Resource Group Whose type is Manual

{
  "resources" : [ {
    "namespace" : "SYS.ECS",
    "dimensions" : [ {
      "name" : "instance_id",
      "value" : "4270ff17-aba3-4138-89fa-820594c39755"
    } ]
  } ]
}

Example Responses

Status code: 200

Resources deleted.

{
  "succeed_count" : 4
}

Status Codes

Status Code

Description

200

Resources deleted.

400

Failed to verify parameters.

404

Resource not found.

500

Internal system error.

Error Codes

See Error Codes.