All Products
Search
Document Center

Resource Management:ListResources

Last Updated:Oct 16, 2026

Queries the resources in the resource groups accessible to the current account.

Operation description

Note

This API can be called by assuming a RAM role, but session policies for the role are not supported.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ResourceGroupId

string

No

The ID of the resource group.

rg-uPJpP****

Service

string

No

The cloud service code.

You can obtain the code from the Cloud Service Code column in Cloud services that support resource groups.

ecs

Region

string

No

The region ID.

cn-hangzhou

ResourceType

string

No

The resource type.

You can obtain the resource type from the Resource Type column in Cloud services that support resource groups.

instance

ResourceId

string

No

The ID of the resource.

i-23v38****

PageNumber

integer

No

The page number.

Minimum value: 1. Default value: 1.

1

PageSize

integer

No

The number of entries per page.

Valid values: 1 to 100. Default value: 10.

10

ResourceTypes

array<object>

No

Specifies whether to query the total number of resources. Default value: true. Valid values:

  • true: Queries the total number of resources and returns the value in the TotalCount parameter.

  • false: Does not query the total number of resources. The TotalCount parameter returns -1, and the resource list is still returned in pages based on the PageNumber and PageSize parameters.

object

No

The list of resource types.

ResourceType

string

No

The resource type.

Valid values of N: 1 to 50.

You can obtain the type from the Resource Type column in Cloud services that support resource groups.

Note

The Service and ResourceType parameters in ResourceTypes must be set at the same time. Otherwise, they do not take effect.

instance

Service

string

No

The cloud service code.

Valid values of N: 1 to 50.

You can obtain the code from the Cloud Service Code column in Cloud services that support resource groups.

Note

The Service and ResourceType parameters in ResourceTypes must be set at the same time. Otherwise, they do not take effect.

ecs

Response elements

Element

Type

Description

Example

object

The response.

PageNumber

integer

The page number.

1

PageSize

integer

The number of entries per page.

10

RequestId

string

The ID of the request.

04F0F334-1335-436C-A1D7-6C044FE73368

Resources

object

Resource

array<object>

The resource information.

object

The resource information.

CreateDate

string

The time when the resource was created. The time is displayed in UTC.

2015-01-23T12:33:18Z

RegionId

string

The region ID.

cn-hangzhou

ResourceGroupId

string

The ID of the resource group.

rg-uPJpP****

ResourceId

string

The ID of the resource.

i-23v38****

ResourceType

string

The resource type.

instance

Service

string

The cloud service code.

ecs

TotalCount

integer

The total number of entries.

1

Examples

Success response

JSON format

{
  "PageNumber": 1,
  "PageSize": 10,
  "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
  "Resources": {
    "Resource": [
      {
        "CreateDate": "2015-01-23T12:33:18Z",
        "RegionId": "cn-hangzhou",
        "ResourceGroupId": "rg-uPJpP****",
        "ResourceId": "i-23v38****",
        "ResourceType": "instance",
        "Service": "ecs"
      }
    ]
  },
  "TotalCount": 1
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.ResourceIds The ResourceIds is invalid. The ResourceIds is invalid.
400 LimitExceeded.ResourceIds The maximum number of ResourceId is exceeded. The maximum number of ResourceId is exceeded.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.