Updated on 2026-06-11 GMT+08:00

Querying Resource Groups

Function

This API is used to query resource groups.

Debugging

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

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    ces:resourceGroups:list

    List

    -

    g:EnterpriseProjectId

    ces:resourceGroups:get

    -

URI

GET /v2/{project_id}/resource-groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

Definition

ID of the enterprise project.

Constraints

N/A

Range

The value contains 36 characters. It can only contain lowercase letters, digits, hyphens (-), and underscores (_). It can also be 0 (ID of the default enterprise project), or all_granted_eps (IDs of all enterprise projects).

Default Value

N/A

group_name

No

String

Definition

Resource group name. Fuzzy search is supported.

Constraints

N/A

Range

It allows 1 to 128 characters and can contain letters, digits, underscores (_), and hyphens (-).

Default Value

N/A

group_id

No

String

Definition

Resource group ID.

Constraints

N/A

Range

The value starts with rg and is followed by 22 characters that can include letters and digits.

Default Value

N/A

offset

No

Integer

Definition

Pagination start value.

Constraints

N/A

Range

[0,10000]

Default Value

0

limit

No

Integer

Definition

Number of records on each page.

Constraints

N/A

Range

[1,100]

Default Value

100

type

No

String

Definition

Method for adding resources to a resource group. If this parameter is not transferred, all resource group types are queried.

Constraints

N/A

Range

  • EPS: by enterprise project.

  • TAG: by tag.

  • Manual: manual addition.

  • COMB: by multiple criteria.

  • NAME: by instance name.

Default Value

N/A

status

No

String

Definition

Health status of a resource group.

Constraints

N/A

Range

  • health: No alarms are generated.

  • unhealthy: An alarm is generated.

  • no_alarm_rule: No alarm rules have been set.

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters.

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Definition

Total number of resource groups.

Range

[0,1000]

resource_groups

Array of OneResourceGroupResp objects

Definition

Resource groups.

Table 5 OneResourceGroupResp

Parameter

Type

Description

group_name

String

Definition

Resource group name.

Range

The value allows 1 to 128 characters. It can only contain letters, digits, hyphens (-), and underscores (_).

group_id

String

Definition

Resource group ID.

Range

The value starts with rg and is followed by 22 characters that can include letters and digits.

create_time

String

Definition

Time when a resource group was created. The value is a UNIX timestamp in milliseconds. Example: 1603819753000

update_time

String

Definition

Time when the resource group was modified. The value is a UNIX timestamp in milliseconds. Example: 1603819753000

enterprise_project_id

String

Definition

ID of the enterprise project that a resource group belongs to.

Range

The value contains 36 characters. It can only contain lowercase letters, digits, and hyphens (-). It can be 0 (ID of the default enterprise project).

type

String

Definition

Method for adding resources to a resource group.

Range

  • EPS: by enterprise project.

  • TAG: by tag.

  • Manual: manual addition.

  • COMB: by multiple criteria.

  • NAME: by instance name.

status

String

Definition

Metric monitoring status of the resource group.

Range

  • health: No alarms are generated.

  • unhealthy: An alarm is generated.

  • no_alarm_rule: No alarm rules have been set.

event_status

String

Definition

Event monitoring status of the resource group.

Range

  • health: No alarms are generated.

  • unhealthy: An alarm is generated.

  • no_alarm_rule: No alarm rules have been set.

resource_statistics

resource_statistics object

Definition

Resource statistics in the resource group.

related_ep_ids

Array of strings

Definition

Enterprise projects specified when the resource matching rule is set to Enterprise Project.

association_alarm_templates

Array of AssociationAlarmTemplate objects

Definition

Associated alarm templates.

resource_level

String

Definition

Resource level, which indicates the effective resource scope.

Range

  • product: cloud product.

  • dimension: specific dimension.

Table 6 resource_statistics

Parameter

Type

Description

unhealthy

Integer

Definition

Number of resources in the Alarm state in the resource group.

Range

[0,9999999]

total

Integer

Definition

Total number of resources in the resource group.

Range

[0,9999999]

event_unhealthy

Integer

Definition

Number of resources that have triggered alarms in the resource group.

Range

[0,9999999]

namespaces

Integer

Definition

Number of resource types in the resource group. For example, if ECS, EIP, and bandwidth are added to the resource group, the value is 2.

Range

[0,9999999]

Table 7 AssociationAlarmTemplate

Parameter

Type

Description

template_id

String

Definition

Alarm template ID.

Range

The value starts with at and allows 2 to 64 characters. It can contain only letters and digits.

template_name

String

Definition

Alarm template name.

Range

The value must start with a letter and allows 1 to 128 characters. It can contain only letters, digits, underscores (_), and hyphens (-).

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Status codes customized by each cloud service when a request error occurs.

error_msg

String

Request error message.

request_id

String

Request ID.

Example Requests

Query resource groups.

/v2/{project_id}/resource-groups?offset=0&limit=100

/v2/{project_id}/resource-groups?offset=0&limit=100

Example Responses

Status code: 200

OK

{
  "resource_groups" : [ {
    "group_name" : "group1",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "update_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "0",
    "type" : "Manual",
    "status" : "health",
    "event_status" : "no_alarm_rule",
    "resource_statistics" : {
      "event_unhealthy" : 0,
      "namespaces" : 1,
      "total" : 14,
      "unhealthy" : 0
    },
    "related_ep_ids" : [ ],
    "association_alarm_templates" : [ ],
    "resource_level" : "product"
  }, {
    "group_name" : "band",
    "type" : "EPS",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "update_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "d61d4705-5658-42f5-8e0c-70eb34d17b02",
    "status" : "health",
    "event_status" : "no_alarm_rule",
    "resource_statistics" : {
      "event_unhealthy" : 0,
      "namespaces" : 0,
      "total" : 0,
      "unhealthy" : 0
    },
    "related_ep_ids" : [ "0" ],
    "association_alarm_templates" : [ ],
    "resource_level" : "product"
  }, {
    "group_name" : "group2",
    "type" : "TAG",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "update_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "0",
    "status" : "unhealthy",
    "event_status" : "no_alarm_rule",
    "resource_statistics" : {
      "event_unhealthy" : 0,
      "namespaces" : 1,
      "total" : 14,
      "unhealthy" : 1
    },
    "related_ep_ids" : [ ],
    "association_alarm_templates" : [ {
      "template_id" : "at12321321",
      "template_name" : "templatexxx"
    } ],
    "resource_level" : "dimension"
  } ],
  "count" : 3
}

Status Codes

Status Code

Description

200

OK

400

Parameter verification failed.

401

Not authenticated.

403

Authentication failed.

500

Internal system error.

Error Codes

See Error Codes.