Help Center/ Cloud Eye/ API Reference/ API V2/ Resource Groups/ Querying Resource Groups
Updated on 2025-08-13 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.

URI

GET /v2/{project_id}/resource-groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

enterprise_project_id

No

String

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

Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$

group_name

No

String

Resource group name. Fuzzy search is supported.

group_id

No

String

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

offset

No

Integer

Start position for pagination query, indicating the sequence number of the data record where the query starts. The default value is 0.

Value range:

0-10000

limit

No

Integer

Number of items on each page during pagination query. The value ranges from 1 to 100 (default).

Value range:

1-100

type

No

String

Method for adding resources to a resource group. The value can only be EPS (synchronizing resources from enterprise projects), TAG (dynamic tag matching), Manual (manually adding resources), COMB (automatically adding resources – matching by multiple criteria), or NAME (fuzzy matching by resource name). If this parameter is not specified, all resource groups are queried.

Enumeration values:

  • EPS

  • TAG

  • Manual

  • COMB

  • NAME

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Tenant token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total number of resource groups.

Value range:

0-1000

resource_groups

Array of OneResourceGroupResp objects

Resource group list.

Table 5 OneResourceGroupResp

Parameter

Type

Description

group_name

String

Resource group name.

Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$

group_id

String

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

create_time

String

Time when a resource group was created.

enterprise_project_id

String

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

Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$

type

String

Resource adding/matching mode. The value can only be EPS (matching enterprise projects), TAG (matching tags), NAME (matching instance names), COMB (combination matching), or Manual (manual adding).

Enumeration values:

  • EPS

  • TAG

  • NAME

  • COMB

  • Manual

status

String

Metric alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set).

Enumeration values:

  • health

  • unhealthy

  • no_alarm_rule

event_status

String

Event alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set).

Enumeration values:

  • health

  • unhealthy

  • no_alarm_rule

resource_statistics

resource_statistics object

Resource quantity statistics.

related_ep_ids

Array of strings

List of specified enterprise projects when the resource matching rule is enterprise project matching.

association_alarm_templates

Array of AssociationAlarmTemplate objects

List of associated alarm templates.

Table 6 resource_statistics

Parameter

Type

Description

unhealthy

Integer

Number of resources in the alarm

Value range:

0-9999999

total

Integer

Total number of resources.

Value range:

0-9999999

event_unhealthy

Integer

Number of triggered resources

Value range:

0-9999999

namespaces

Integer

Resource Types

Value range:

0-9999999

Table 7 AssociationAlarmTemplate

Parameter

Type

Description

template_id

String

ID of an alarm template.

template_name

String

Alarm template name

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

Example Responses

Status code: 200

OK

{
  "resource_groups" : [ {
    "group_name" : "group1",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "0",
    "type" : "Manual"
  }, {
    "group_name" : "band",
    "type" : "EPS",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "d61d4705-5658-42f5-8e0c-70eb34d17b02"
  }, {
    "group_name" : "group2",
    "type" : "TAG",
    "create_time" : "2006-01-02T15:04:05.000Z",
    "group_id" : "rg0123456789xxxx",
    "enterprise_project_id" : "0"
  } ],
  "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.