Help Center/ Global Accelerator/ API Reference/ API/ Tag/ Querying the Number of Resources by Tag
Updated on 2025-11-10 GMT+08:00

Querying the Number of Resources by Tag

Function

This API is used to query the number of resources by tag.

Calling Method

For details, see Calling APIs.

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

    ga::listResourcesByTag

    List

    -

    g:TagKeys

    • ga:tag:listResourcesByTag

    -

URI

POST /v1/{resource_type}/resource-instances/count

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

resource_type

Yes

Object

Resource type. Value range:

  • ga-accelerators: Global accelerators

  • ga-listeners: Listeners

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the user token. The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of Tag objects

Specifies the tag list.

matches

No

Array of Match objects

Specifies the matched results.

Table 4 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

The tag key.

values

Yes

Array of strings

The list of tag values.

Table 5 Match

Parameter

Mandatory

Type

Description

key

Yes

String

The key for matching a resource instance.

Range:

resource_name: Resource name

value

Yes

String

The value for matching a resource instance.

Response Parameters

Status code: 200

Table 6 Response body parameters

Parameter

Type

Description

total_count

Integer

Specifies the total number of resources.

request_id

String

Specifies the request ID.

Example Requests

Querying the Number of Resources by Tag

POST https://{ga_endpoint}/v1/{resource_type}/resource-instances/count

{
  "tags" : [ {
    "key" : "tagKey",
    "values" : [ "tagValue" ]
  } ],
  "matches" : [ {
    "key" : "resourceName",
    "value" : "name"
  } ]
}

Example Responses

Status code: 200

Operation successful.

{
  "total_count" : 10,
  "request_id" : "ac1bf54f-6a23-4074-af77-800648d25bc9"
}

Status Codes

Status Code

Description

200

Operation successful.

Error Codes

See Error Codes.