All Products
Search
Document Center

:ListResources

Last Updated:Dec 08, 2023

Queries the resources that can be accessed by the current account in resource groups.

Note You can use a RAM role that is not associated with a session policy to call this API operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes ListResources

The operation that you want to perform. Set the value to ListResources.

ResourceGroupId String No rg-uPJpP****

The resource group ID.

Service String No ecs

The service code.

You can obtain the code from the Service code column in Services that work with Resource Group.

Region String No cn-hangzhou

The region ID.

ResourceType String No instance

The resource type.

You can obtain the resource type from the Resource type column in Services that work with Resource Group.

ResourceId String No i-23v38****

The resource ID.

PageNumber Integer No 1

The page number.

Pages start from page 1. Default value: 1.

PageSize Integer No 10

The number of entries per page.

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

ResourceTypes.N.Service String No ecs

The service code.

Valid values of N: 1 to 50.

You can obtain the code from the Service code column in Services that work with Resource Group.

Note You must configure both ResourceTypes.N.Service and ResourceTypes.N.ResourceType. Otherwise, the two parameters do not take effect.
ResourceTypes.N.ResourceType String No instance

The resource type.

Valid values of N: 1 to 50.

You can obtain the resource type from the Resource type column in Services that work with Resource Group.

Note You must configure both ResourceTypes.N.Service and ResourceTypes.N.ResourceType. Otherwise, the two parameters do not take effect.

Response parameters

Parameter

Type

Example

Description

TotalCount Integer 1

The total number of entries returned.

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

The request ID.

PageSize Integer 10

The number of entries per page.

PageNumber Integer 1

The page number.

Resources Array of Resource

The information about the resources.

Resource
Service String ecs

The service code.

ResourceType String instance

The resource type.

ResourceGroupId String rg-uPJpP****

The resource group ID.

ResourceId String i-23v38****

The resource ID.

CreateDate String 2015-01-23T12:33:18Z

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

RegionId String cn-hangzhou

The region ID.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=ListResources
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<?xml version="1.0" encoding="UTF-8" ?>
<ListResourcesResponse>
	<RequesgtId>04F0F334-1335-436C-A1D7-6C044FE73368</RequesgtId>
	<PageNumber>1</PageNumber>
	<PageSize>10</PageSize>
	<TotalCount>1</TotalCount>
	<Resources>
		<Resource>
			<ResourceGroupId>rg-uPJpP****</ResourceGroupId>
			<Service>ecs</Service>
			<ResourceType>instance</ResourceType>
			<ResourceId>i-23v38****</ResourceId>
			<RegionId>cn-hangzhou</RegionId>
			<CreateDate>2015-01-23T12:33:18Z</CreateDate>
		</Resource>
	</Resources>
</ListResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.ResourceIds The ResourceIds is invalid. The value of the ResourceIds parameter is invalid.
400 LimitExceeded.ResourceIds The maximum number of ResourceId is exceeded. The number of specified resource IDs has exceeded the upper limit.

For a list of error codes, see Service error codes.