Updated on 2025-12-05 GMT+08:00

Querying the Total Number of User Resources

Function

This API is used to query the total number of user resources.

Users can query resources. The number of resource data records that meet the filter criteria can be returned.

URI

GET /v1/resources/count

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

provider

Yes

String

Definition

Cloud service name.

Constraints

N/A

Range

The value is a string. The value can be ecs, cce, or rds.

Default value

N/A

type

Yes

String

Definition

Resource type.

Constraints

N/A

Range

There are many resource types. Select a resource type based on the actual service. The common resource types are as follows:

  • cloudservers: Elastic Cloud Servers (ECSs)

  • servers: Bare Metal Servers (BMSs)

  • clusters: Cloud Container Engine (CCE)

  • instances: cloud database instances

Default value

N/A

resource_id_list

No

Array of strings

Definition

Resource ID list.

Constraints

N/A

Range

A collection of resource IDs selected by users.

Default value

N/A

name

No

String

Definition

Cloud resource name.

Constraints

N/A

Range

The value is a string. For details, see Bare Metal Server (BMS).

Default value

N/A

region_id

No

String

Definition

Region ID.

Constraints

N/A

Range

ID of the region with which the region is associated.

Default value

N/A

az_id

No

String

Definition

AZ ID.

Constraints

N/A

Range

N/A

Default value

N/A

ip_type

No

String

Definition

IP address type.

Constraints

N/A

Range

  • fixed: internal IP address

  • floating: EIP

Default value

N/A

ip

No

String

Definition

Cloud resource IP address.

Constraints

N/A

Range

Filtering results for IPv4 addresses, which are fuzzy matched.

Default value

N/A

status

No

String

Description:

Cloud resource status.

Constraints:

N/A

Value range:

Select an ECS status by referring toECS.

Default value:

N/A

agent_state

No

String

Definition

Agent status.

Constraints

N/A

Range

  • ONLINE: The UniAgent is running.

  • OFFLINE: The UniAgent is abnormal.

  • INSTALLING: The UniAgent is being installed.

  • FAILED: The UniAgent fails to be installed.

  • UNINSTALLED: The UniAgent is uninstalled.

  • null: The UniAgent is not installed.

Default value

N/A

image_name

No

String

Definition

Image name, which is used for fuzzy match.

Constraints

N/A

Range

N/A

Default value

N/A

os_type

No

String

Definition

System type.

Constraints

N/A

Range

  • windows: Windows OS.

  • linux: Linux OS.

Default value

N/A

tag

No

String

Definition

Cloud resource tag.

Constraints

A tag is in the format of "key.value". The maximum lengths of the key and value are 36 and 43 characters, respectively.

Range

The key of the tag can contain only letters, digits, underscores (), and hyphens (-). The value of the tag can contain only letters, digits, underscores (), hyphens (-), and periods (.).

Default value

N/A

tag_key

No

String

Definition

Tag key of a cloud resource.

Constraints

N/A

Range

N/A

Default value

N/A

group_id

No

String

Definition

Group ID of a cloud resource.

Constraints

If the group ID is used, the number of resources in the group is queried.

Range

N/A

Default value

N/A

component_id

No

String

Definition

Component ID of a cloud resource.

Constraints

If the component ID is used, the number of resources in the component is queried.

Range

N/A

Default value

N/A

application_id

No

String

Definition

Application ID of a cloud resource.

Constraints

If the application ID is used, the number of resources of the application is queried.

Range

N/A

Default value

N/A

cce_cluster_id

No

String

Definition

CCE cluster ID.

Constraints

N/A

Range

ID of the CCE cluster to which the resource belongs.

Default value

N/A

ep_id

No

String

Definition

Enterprise project ID.

Constraints

N/A

Range

Select a project ID that is available inEnterprise Management.

Default value

N/A

is_delegated

No

String

Definition

Whether the resource is managed.

Constraints

N/A

Range

  • true: The resource is managed.

  • false: The resource is not managed.

Default value

N/A

is_collected

No

Boolean

Definition

Whether to add it to favorites.

Constraints

N/A

Range

  • true: The enterprise project has been added to favorites.

  • false: The enterprise project is not added to favorites.

Default value

N/A

flavor_name

No

String

Definition

Resource flavor name.

Constraints

N/A

Range

N/A

Default value

N/A

charging_mode

No

String

Definition

Cloud server billing mode.

Constraints

N/A

Range

Billing mode:

  • 0: pay-per-use

  • 1: yearly/monthly

  • 2: spot price

Default value

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response header parameters

Parameter

Type

Description

X-request-id

String

Definition

Request ID used for task tracing.

Range

request_uuid-timestamp-host_name.

Table 3 Response body parameters

Parameter

Type

Description

data

Long

Definition

Number of cloud resources.

Range

The value range is 0 to 65,535.

Status code: 400

Table 4 Response header parameters

Parameter

Type

Description

X-request-id

String

Definition

Request ID used for task tracing.

Range

request_uuid-timestamp-host_name.

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

The value is a string. It contains 8 to 36 characters.

error_msg

String

Definition

Error description.

Range

The value is a string. It contains 2 to 512 characters.

Example Requests

Query the total number of user resources.

GET https://{Endpoint}/v1/resources/count?type=clusters&provider=cce&is_collected=false

Example Responses

Status code: 200

The total number of resources is queried.

{
  "data" : 54
}

Status Codes

Status Code

Description

200

The total number of resources is queried.

400

The total number of resources fails to be queried.

Error Codes

See Error Codes.