Queries the resources that can be accessed by the current account in resource groups.
This topic provides an example on how to call the API operation to query the resources
that can be accessed by the current account in resource groups. The response shows
that the current account can access only the Elastic Compute Service (ECS) instance
i-23v38****
in the resource group rg-uPJpP****
.
Debugging
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 ID of the resource group. |
Service | String | No | ecs |
The ID of the Alibaba Cloud service. You can obtain the ID from the Service code column in Alibaba Cloud services that support resource groups. |
Region | String | No | cn-hangzhou |
The region ID. |
ResourceType | String | No | instance |
The resource type. For more information about the supported resource types, see the Resource type column in Alibaba Cloud services that support resource groups. |
ResourceId | String | No | i-23v38**** |
The ID of the resource. |
PageNumber | Integer | No | 1 |
The number of the page to return. Pages start from page 1. Default value: 1. |
PageSize | Integer | No | 10 |
The number of entries to return on each page. Valid values: 1 to 100. Default value: 10. |
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
TotalCount | Integer | 1 |
The total number of entries returned. |
RequestId | String | 04F0F334-1335-436C-A1D7-6C044FE73368 |
The ID of the request. |
PageSize | Integer | 10 |
The number of entries returned per page. |
PageNumber | Integer | 1 |
The page number of the returned page. |
Resources | Array of Resource |
The information of the resources. |
|
Resource | |||
Service | String | ecs |
The ID of the Alibaba Cloud service. |
ResourceType | String | instance |
The type of the resource. |
ResourceGroupId | String | rg-uPJpP**** |
The ID of the resource group. |
ResourceId | String | i-23v38**** |
The ID of the resource. |
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 error message returned because the value of the ResourceIds parameter is invalid. |
400 | LimitExceeded.ResourceIds | The maximum number of ResourceId is exceeded. | The error message returned because the number of specified resource IDs has exceeded the upper limit. |
For a list of error codes, visit the API Error Center.