Updated on 2025-10-24 GMT+08:00

Querying All Resources of a User

Function

This API is used to query all resources of a user.

  • The information about all resources of a tenant can help the tenant learn about the overall resource status.

  • The request parameters provider (cloud service name), type (cloud resource type), and limit (number of records) are mandatory. The maximum number of records that can be queried at a time is 200.

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

    coc:instance:listResources

    List

    -

    -

    -

    -

URI

GET /v1/external/resources

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

provider

Yes

String

Definition:

Cloud service name.

Constraints:

  • If the number of created cloud resources (value of the count field) is greater than 1, you can use Auto Sort and Regular Sort to set the names of ordered cloud resources.

  • If the number of created cloud resources (the value of count) is greater than 1, the system automatically adds a mark similar to -0000 to the end of each cloud resource name to differentiate cloud resources. If you specify a number, the name of the first new resource will start from the specified number. In this case, the ECS name contains 1 to 59 characters.

Value range:

The value can contain 1 to 128 English characters or 1 to 64 Chinese characters, including only letters, digits, underscores (_), hyphens (-), and periods (.).

Default value:

N/A

type

Yes

String

Definition:

Resource type.

Constraints:

N/A

Value 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 server (BMSs)

  • clusters: Cloud Container Engine (CCE) instances

  • instances: cloud database instances

Default value:

N/A

limit

Yes

Integer

Definition:

Number of items displayed on each page when the pagination query is performed.

Constraints:

N/A

Value range:

It is user-defined. The value ranges from 1 to 500.

Default value:

N/A

marker

No

String

Definition:

It is used for pagination query.

Constraints:

N/A

Value range:

Pagination parameter. You can use the marker value returned in the previous request as the number of the first page of records to return in this request.

Default value:

N/A

resource_id_list

No

Array of strings

Definition:

Resource ID list.

Constraints:

N/A

Value range:

Resource ID list. The maximum value is 100.

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.

Value range:

request_uuid-timestamp-host name.

Table 3 Response body parameters

Parameter

Type

Description

data

Array of data objects

Definition:

Resource list.

Value Range:

The value ranges from 0 to 500.

Table 4 data

Parameter

Type

Description

id

String

Definition:

Resource ID allocated by CloudCMDB.

Value Range:

N/A

resource_id

String

Definition:

ID of the resource allocated by the cloud service.

Value Range:

The value is a string with 36 characters.

domain_id

String

Definition:

Tenant ID.

Value Range:

N/A

name

String

Definition:

Resource name.

Value Range:

The value is a string with 3 to 50 characters.

provider

String

Definition:

Cloud service name

Value Range:

The value is a string with 1 to 64 characters.

type

String

Definition:

Resource type. Options:

Value 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 server (BMS) instances

  • clusters: Cloud Container Engine (CCE) instances

  • instances: cloud database instances

project_id

String

Definition:

Project ID in OpenStack.

Value Range:

The value is a string with 32 characters.

project_name

String

Definition:

Sub-project name of a region.

Value Range:

The value is a string with a maximum of 255 characters.

region_id

String

Definition:

Region ID.

Value Range:

The value is a string with 0 to 64 characters.

ep_id

String

Definition:

Enterprise project ID.

Value Range:

Select a project ID that exists inEnterprise Management.

ep_name

String

Definition:

Enterprise project name.

Value Range:

The value can contain a maximum of 255 characters, including letters, digits, underscores (_), and hyphens (-). The value cannot be "default" in any case.

tags

Object

Definition:

Resource tag.

Value Range:

N/A

agent_id

String

Definition:

ID of the UniAgent.

Value Range:

N/A

agent_state

String

Definition:

UniAgent status.

Value Range:

  • ONLINE: running

  • OFFLINE: abnormal

  • INSTALLING: being installed

  • FAILED: installation failed

  • UNINSTALLED: uninstalled

  • null: not installed

properties

Object

Definition:

Resource attributes.

Value Range:

N/A

ingest_properties

Map<String,String>

Definition:

Collection attribute.

Value Range:

N/A

is_delegated

Boolean

Definition:

Hosted

Value Range:

  • true: Delegation has been performed.

  • false: Delegation is not performed.

inner_ip

String

Definition:

Internal IP address of the resource.

Value Range:

N/A

operable

Boolean

Definition:

Users can define whether O&M can be performed on a resource.

Value Range:

  • ENABLE: The instance can be maintained.

  • DISABLE: The operable field does not exist if O&M cannot be performed on the instance.

is_associate_group

Boolean

Definition:

Whether the resource has been associated with a specified group.

Value Range:

  • true: The resource has been associated with a specified group.

  • false: the resource has not been associated with a specified group.

associated_group_list

Array of strings

Definition:

List of groups associated with a resource.

Value Range:

N/A

create_time

String

Definition:

Creation time. The value is in the ISO 8601 format.

Value Range:

N/A

update_time

String

Definition:

Modification time. The value is in the ISO 8601 format.

Value Range:

N/A

Table 5 TagResponse

Parameter

Type

Description

key

String

Definition:

Tag key.

Value range:

The tag key cannot start or end with a space, or start with sys. It can contain letters, digits, spaces, and the following special characters: _.:=+-@. A maximum of 128 characters are allowed.

value

String

Definition:

Tag value.

Value range:

A tag value can contain a maximum of 255 characters. It cannot start or end with a space. Only letters, digits, spaces, and the following special characters are allowed: _ . : / = + - @

Status code: 400

Table 6 Response header parameters

Parameter

Type

Description

X-request-id

String

Definition:

Request ID used for task tracing.

Value range:

request_uuid-timestamp-host name.

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

The value contains 8 to 36 characters.

error_msg

String

Definition:

Error description.

Value range:

The value contains 2 to 512 characters.

Example Requests

This API is used to query all resources of a user.

GET https://{Endpoint}/v1/external/resources?limit=10&offset=0&type=cloudservers&provider=ecs&is_collected=true

Example Responses

Status code: 200

Querying all resources of the user succeeded.

{
  "data" : [ {
    "id" : "6891f55f1c083f512c6b222c",
    "resource_id" : "37b64b7c-cdc9-4c2b-8f34-b8fa450bfbd2",
    "name" : "auto-script-runbook-0005-0003",
    "ep_id" : "0",
    "ep_name" : "default",
    "project_id" : "10a6c23c2a1044779794798beb067c94",
    "project_name" : "testregion",
    "domain_id" : "dc2d76541f754d68a4c8d150262d92c2",
    "provider" : "ecs",
    "type" : "cloudservers",
    "region_id" : "testregion",
    "tags" : [ {
      "key" : "_sys_type_hcss_x",
      "value" : ""
    } ],
    "properties" : {
      "accessIpv4" : "",
      "hostName" : "auto-script-runbook-0005-0003",
      "addresses" : [ {
        "OsExtIpsType" : "fixed",
        "OsExtIpsPortId" : "05f5d9db-bb16-404a-a2a5-a5969942f330",
        "addr" : "192.168.3.104",
        "version" : 4,
        "OsExtIpsMacAddr" : "fa:16:3e:a3:fe:63",
        "primary" : true
      } ],
      "accessIpv6" : "",
      "metadata" : {
        "chargingMode" : "0",
        "meteringImageType" : "gold",
        "imageName" : "CentOS 7.5 64bit",
        "meteringImageId" : "e0adce3a-a4d2-4207-9018-69ce64b4426a",
        "meteringResourcesPerCode" : "x1.1u.1g.linux",
        "vpcId" : "7a7087df-cca1-4fab-9aae-c2105a1a49fb",
        "osBit" : "64",
        "osType" : "Linux"
      },
      "OsExtStsVmState" : "active",
      "configDrive" : "",
      "OsExtStsPowerState" : 1,
      "hostId" : "52db359758486a662c841d888b49d0d0a184208e497e2a0eb0f065f7",
      "securityGroup" : [ {
        "name" : "default",
        "id" : "9e262f72-2f9a-4534-8a56-412710913895"
      } ],
      "ExtVolumesAttached" : [ {
        "bootIndex" : "0",
        "id" : "3bd6d353-979e-43d8-8936-ce2e246d79fd",
        "device" : "/dev/vda"
      } ],
      "userId" : "a0ea25cd3a7549208e93971d80424481",
      "flavor" : {
        "disk" : "0",
        "name" : "x1.1u.1g",
        "id" : "x1.1u.1g",
        "vcpus" : "1",
        "ram" : "1024"
      },
      "osextsrvattr" : {
        "hostName" : "auto-script-runbook-0005-0003",
        "kernelId" : "",
        "ramdiskId" : "",
        "reservationId" : "r-hnvhg2wd",
        "instanceName" : "instance-013ea14f",
        "host" : "52db359758486a662c841d888b49d0d0a184208e497e2a0eb0f065f7",
        "rootDeviceName" : "/dev/vda",
        "hypervisorHostName" : "52db359758486a662c841d888b49d0d0a184208e497e2a0eb0f065f7",
        "launchIndex" : 0
      },
      "OsDcfDiskConfig" : "MANUAL",
      "hostStatus" : "UP",
      "OsSrvUsgLaunchedAt" : "2025-08-05T07:14:07.000000",
      "OsExtAz" : "test11",
      "progress" : 0,
      "locked" : false,
      "status" : "ACTIVE",
      "schedulerHints" : { }
    },
    "ingest_properties" : null,
    "agent_id" : "9cf256e04bbe49f89593cfb66a3b5956",
    "agent_state" : "ONLINE",
    "inner_ip" : "192.168.3.104",
    "is_delegated" : null,
    "operable" : null,
    "is_associate_group" : null,
    "associated_group_list" : null,
    "create_time" : "2025-08-05T07:13:55.000+00:00",
    "update_time" : "2025-08-05T08:04:05.000+00:00"
  } ]
}

Status Codes

Status Code

Description

200

Querying all resources of the user succeeded.

400

Failed to query all resources of the user.

Error Codes

See Error Codes.