All Products
Search
Document Center

Resource Management:ListResources

Last Updated:Jun 05, 2024

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

Operation description

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

This topic provides an example on how to call the API operation to query 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceGroupIdstringNo

The ID of the resource group.

rg-uPJpP****
ServicestringNo

The ID of the Alibaba Cloud service.

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

ecs
RegionstringNo

The region ID.

cn-hangzhou
ResourceTypestringNo

The resource type.

For more information about the supported resource types, see the Resource type column in Services that work with Resource Group.

instance
ResourceIdstringNo

The ID of the resource.

i-23v38****
PageNumberintegerNo

The page number.

Pages start from page 1. Default value: 1.

1
PageSizeintegerNo

The number of entries per page.

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

10
ResourceTypesobject []No

The resource types. A maximum of 50 resource types are supported.

Note If you configure ResourceTypes, you must configure both Service and ResourceType. Otherwise, the configured Service or ResourceType does not take effect.
ServicestringNo

The ID of the Alibaba Cloud service.

Valid values of N: 1 to 50.

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

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

The resource type.

Valid values of N: 1 to 50.

For more information about the supported resource types, see the Resource type column in Services that work with Resource Group.

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

For more information about common request parameters, see Common parameters.

Response parameters

ParameterTypeDescriptionExample
object

The returned result.

TotalCountinteger

The total number of entries returned.

1
RequestIdstring

The request ID.

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

The number of entries per page.

10
PageNumberinteger

The page number.

1
Resourcesobject []

The information about the resources.

Servicestring

The ID of the Alibaba Cloud service.

ecs
ResourceTypestring

The resource type.

instance
ResourceGroupIdstring

The ID of the resource group.

rg-uPJpP****
ResourceIdstring

The ID of the resource.

i-23v38****
CreateDatestring

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

2015-01-23T12:33:18Z
RegionIdstring

The region ID.

cn-hangzhou

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.ResourceIdsThe ResourceIds is invalid.The ResourceIds is invalid.
400LimitExceeded.ResourceIdsThe maximum number of ResourceId is exceeded.The maximum number of ResourceId is exceeded.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-26The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: ResourceTypes