All Products
Search
Document Center

Resource Management:GetResourceGroupResourceCounts

Last Updated:Dec 15, 2025

Queries the number of resources in a visible resource group.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceTypesarray<object>No

The resource types.

objectNo

The resource type.

ResourceTypeCodestringNo

The resource type.

You can obtain the resource type from the Resource type column in Services that work with Resource Group.

instance
ServicestringNo

The service code.

You can obtain the code from the Service code column in Services that work with Resource Group.

ecs
GroupByKeystringNo

The dimension by which resources are queried.

Note If you do not specify a dimension, no results are returned.

Valid values:

  • ResourceGroupId
  • ResourceType
ResourceGroupId
ResourceGroupIdstringNo

The resource group ID.

You can call the ListResourceGroups operation to obtain the ID.

rg-9gLOoK****
ResourceRegionIdstringNo

The region ID of the resources.

cn-shanghai

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

RequestIdstring

The request ID.

9B34724D-54B0-4A51-B34D-4512372FE1BE
ResourceCountsarray<object>

The numbers of the resources.

ResourceCountobject

The number of the resources.

Countlong

The number of the resources.

1
GroupByKeystring

The dimension by which resources are queried.

ResourceGroupId
ResourceGroupIdstring

The resource group ID.

rg-9gLOoK****

Examples

Sample success responses

JSONformat

{
  "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
  "ResourceCounts": [
    {
      "Count": 1,
      "GroupByKey": "ResourceGroupId",
      "ResourceGroupId": "rg-9gLOoK****\n"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400UnsupportedResourceTypeThe resource type is not supported.The resource type is not supported.
400InvalidParameter.GroupByKeyThe parameter GroupByKey is invalid.The parameter GroupByKey is invalid.
404EntityNotExists.ResourceGroupThe specified resource group does not exist. You must first create a resource group.The specified resource group does not exist. You must first create a resource group.

For a list of error codes, visit the Service error codes.