Queries the resources that can be accessed within the current account.

Prerequisites

Resource Meta Center (RMC) is enabled. For more information, see Query resources that belong to different resource groups.

Usage notes

For more information about resource types that support RMC, see Resource types that support RMC.

This topic provides an example on how to call the API operation to query the resources that can be accessed within the current account in the China (Hangzhou) region.

QPS limits

You can call this API operation up to 20 times per second per account. Requests that exceed this limit will fail, and you may experience service interruptions. We recommend that you take note of this limit when you call this 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 SearchResources

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

NextToken String No eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****

The token that is used to initiate the next request.

If the total number of entries returned for the current request exceeds the value of the MaxResults parameter, the entries are truncated. In this case, you can use the token to initiate another request and obtain the remaining entries.

MaxResults Integer No 5

The maximum number of entries to return on each page.

Valid values: 1 to 100.

Default value: 20.

ResourceGroupId String No rg-acfmzawhxxc****

The ID of the resource group.

SortCriterion Object No

The method that is used to sort the entries.

Key String No CreateTime

The attribute based on which the entries are sorted.

The value CreateTime indicates the creation time of resources.

Order String No ASC

The order in which the entries are sorted. Valid values:

  • ASC: The entries are sorted in ascending order. This value is the default value.
  • DESC: The entries are sorted in descending order.
Filter.N.Key String No RegionId

The key of the filter condition. Valid values:

  • ResourceType: resource type
  • RegionId: region ID
  • ResourceId: resource ID
  • ResourceGroupId: resource group ID
  • ResourceName: resource name
Filter.N.Value.N String No cn-hangzhou

The value of the filter condition.

Filter.N.MatchType String No Equals

The matching method. Set the value to Equals. This value indicates that resources that match the filter conditions are queried.

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

Response parameters

Parameter Type Example Description
NextToken String eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****

The token that is used to initiate the next request.

RequestId String 14B1E620-E24F-5A0E-B130-AB1488F4F9F1

The ID of the request.

MaxResults Integer 5

The maximum number of entries returned per page.

Filters Array of Filter

The filter conditions.

Key String RegionId

The key of the filter condition.

MatchType String Equals

The matching method.

Values Array of String cn-hangzhou

The value of the filter condition.

Resources Array of Resource

The information of the resources.

ResourceType String ACS::VPC::RouteTable

The type of the resource.

CreateTime String 2021-06-30T09:20:08Z

The time when the resource was created.

Note Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.
ResourceGroupId String rg-acfmzawhxxc****

The ID of the resource group.

ZoneId String cn-hangzhou-k

The zone ID.

Note Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.
AccountId String 151266687691****

The ID of the Alibaba Cloud account.

ResourceId String vtb-bp11lbh452fr8940s****

The ID of the resource.

ResourceName String group1

The name of the resource.

RegionId String cn-hangzhou

The region ID.

Tags Array of Tag

The tags.

Key String k1

The tag key.

Value String v1

The tag value.

IpAddresses Array of String 192.168.1.2

The IP address.

Note Whether this parameter is returned is determined by the Alibaba Cloud service to which the resource belongs.

Examples

Sample requests

https://rmc.aliyuncs.com/?Action=SearchResources
&MaxResults=5
&Filter.1.Key=RegionId
&Filter.1.Value.1=cn-hangzhou
&Filter.1.MatchType=Equals
&<Common request parameters>

Sample success responses

XML format

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

<SearchResourcesResponse>
    <Filters>
        <MatchType>Equals</MatchType>
        <Values>cn-hangzhou</Values>
        <Key>RegionId</Key>
    </Filters>
    <NextToken>eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****</NextToken>
    <RequestId>14B1E620-E24F-5A0E-B130-AB1488F4F9F1</RequestId>
    <MaxResults>5</MaxResults>
    <Resources>
        <Resource>
            <AccountId>151266687691****</AccountId>
            <ResourceId>cen-ygbkum0jusr8qg****:cenrmap-7tdf6cpi4u5o9x****</ResourceId>
            <ResourceType>ACS::CEN::CenRouteMap</ResourceType>
            <RegionId>cn-hangzhou</RegionId>
        </Resource>
        <Resource>
            <AccountId>151266687691****</AccountId>
            <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
            <ResourceId>asdft</ResourceId>
            <ResourceName>asdft</ResourceName>
            <ResourceType>ACS::OOS::Template</ResourceType>
            <RegionId>cn-hangzhou</RegionId>
            <Tags>
                <Value>rg-acfmzawhxxc****</Value>
                <Key>acs:rm:rgId</Key>
            </Tags>
        </Resource>
        <Resource>
            <AccountId>151266687691****</AccountId>
            <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
            <ResourceId>OOSAutoBindTag</ResourceId>
            <ResourceName>OOSAutoBindTag</ResourceName>
            <ResourceType>ACS::OOS::Template</ResourceType>
            <RegionId>cn-hangzhou</RegionId>
            <Tags>
                <Value>rg-acfmzawhxxc****</Value>
                <Key>acs:rm:rgId</Key>
            </Tags>
        </Resource>
        <Resource>
            <AccountId>151266687691****</AccountId>
            <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
            <ResourceId>AutoTag</ResourceId>
            <ResourceName>AutoTag</ResourceName>
            <ResourceType>ACS::OOS::Template</ResourceType>
            <RegionId>cn-hangzhou</RegionId>
            <Tags>
                <Value>rg-acfmzawhxxc****</Value>
                <Key>acs:rm:rgId</Key>
            </Tags>
        </Resource>
        <Resource>
            <AccountId>151266687691****</AccountId>
            <ResourceGroupId>rg-acfmzawhxxc****</ResourceGroupId>
            <ResourceId>vtb-bp11lbh452fr8940s****</ResourceId>
            <ResourceName>group1</ResourceName>
            <CreateTime>2020-08-17T02:18:21Z</CreateTime>
            <ResourceType>ACS::VPC::RouteTable</ResourceType>
            <RegionId>cn-hangzhou</RegionId>
        </Resource>
    </Resources>
</SearchResourcesResponse>

JSON format

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

{
  "Filters" : [ {
    "MatchType" : "Equals",
    "Values" : [ "cn-hangzhou" ],
    "Key" : "RegionId"
  } ],
  "NextToken" : "eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****",
  "RequestId" : "14B1E620-E24F-5A0E-B130-AB1488F4F9F1",
  "MaxResults" : 5,
  "Resources" : [ {
    "AccountId" : "151266687691****",
    "ResourceId" : "cen-ygbkum0jusr8qg****:cenrmap-7tdf6cpi4u5o9x****",
    "ResourceType" : "ACS::CEN::CenRouteMap",
    "RegionId" : "cn-hangzhou"
  }, {
    "AccountId" : "151266687691****",
    "ResourceGroupId" : "rg-acfmzawhxxc****",
    "ResourceId" : "asdft",
    "ResourceName" : "asdft",
    "ResourceType" : "ACS::OOS::Template",
    "RegionId" : "cn-hangzhou",
    "Tags" : [ {
      "Value" : "rg-acfmzawhxxc****",
      "Key" : "acs:rm:rgId"
    } ]
  }, {
    "AccountId" : "151266687691****",
    "ResourceGroupId" : "rg-acfmzawhxxc****",
    "ResourceId" : "OOSAutoBindTag",
    "ResourceName" : "OOSAutoBindTag",
    "ResourceType" : "ACS::OOS::Template",
    "RegionId" : "cn-hangzhou",
    "Tags" : [ {
      "Value" : "rg-acfmzawhxxc****",
      "Key" : "acs:rm:rgId"
    } ]
  }, {
    "AccountId" : "151266687691****",
    "ResourceGroupId" : "rg-acfmzawhxxc****",
    "ResourceId" : "AutoTag",
    "ResourceName" : "AutoTag",
    "ResourceType" : "ACS::OOS::Template",
    "RegionId" : "cn-hangzhou",
    "Tags" : [ {
      "Value" : "rg-acfmzawhxxc****",
      "Key" : "acs:rm:rgId"
    } ]
  }, {
    "AccountId" : "151266687691****",
    "ResourceGroupId" : "rg-acfmzawhxxc****",
    "ResourceId" : "vtb-bp11lbh452fr8940s****",
    "ResourceName" : "group1",
    "CreateTime" : "2020-08-17T02:18:21Z",
    "ResourceType" : "ACS::VPC::RouteTable",
    "RegionId" : "cn-hangzhou",
    "Tags" : [ ]
  } ]
}

Error codes

For a list of error codes, visit the API Error Center.