All Products
Search
Document Center

Resource Management:GetResourceCounts

Last Updated:Jun 21, 2024

Queries the numbers of resources on which the current account has access permissions.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
GroupByKeystringNo

The dimension by which resources are queried. Valid values:

  • ResourceType
  • Region
  • ResourceGroupId
  • TagKey
  • TagValue
ResourceType
Filterobject []No

The filter conditions.

KeystringNo

The key of the filter condition. For more information, see Supported filter parameters.

RegionId
ValuearrayNo

The values of the filter condition.

stringNo

A value of the filter condition.

cn-shanghai
MatchTypestringNo

The matching mode.

The value Equals indicates an equal match.

Equals

Supported filter parameters

ParameterDescriptionSupported matching mode
ResourceTypeThe resource type.Equals
RegionIdThe region ID.Equals
ResourceIdThe resource ID.Equals and Prefix
ResourceGroupIdThe resource group ID.Equals, Exists, and NotExists
ResourceNameThe resource name.Equals and Contains
TagThe key-value pair. The key-value pair must be in the { "key": $key, "value": $value } JSON format. You must specify at least one of key and value. For example, if you want to query the tag key foo and tag value bar, set this parameter to { "key": "foo", "value": "bar" }. If you want to query only the tag key foo, set this parameter to { "key": "foo" }.Contains, NotContains, and NotExists
VpcIdThe VPC ID.Equals
VSwitchIdThe vSwitch ID.Equals

Response parameters

ParameterTypeDescriptionExample
object
GroupByKeystring

The dimension by which resources are queried.

ResourceType
RequestIdstring

The request ID.

6D98D9B0-318D-56A4-910C-93B5F945AF2B
Filtersobject []

The filter conditions.

Keystring

The key of the filter condition.

RegionId
Valuesarray

The values of the filter condition.

string

A value of the filter condition.

cn-shanghai
ResourceCountsobject []

The numbers of resources.

GroupNamestring

The group name.

ACS::ECS::NetworkInterface
Countlong

The number of resources.

2

Examples

Sample success responses

JSONformat

{
  "GroupByKey": "ResourceType",
  "RequestId": "6D98D9B0-318D-56A4-910C-93B5F945AF2B",
  "Filters": [
    {
      "Key": "RegionId",
      "Values": [
        "cn-shanghai"
      ]
    }
  ],
  "ResourceCounts": [
    {
      "GroupName": "ACS::ECS::NetworkInterface",
      "Count": 2
    }
  ]
}

Error codes

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

Change history

Change timeSummary of changesOperation
2023-08-22The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.