Searches for resources in your current account that you are permitted to access.
Operation description
You can search only for resources in your current account that you are permitted to access.
You can search only for the Alibaba Cloud services and resource types that are supported by Resource Center.
By default, the SearchResources operation returns a maximum of 20 entries. You can specify the
MaxResultsparameter to change the maximum number of entries that are returned.If the response does not include a
NextTokenvalue, no more results are available. To retrieve the next page of results, include theNextTokenvalue from the previous response in your next request. If you do not specify theNextTokenparameter, the first page of results is returned.You can set one or more filter conditions to narrow the search scope. For information about the supported filter parameters and matching methods, see the following sections. Multiple filter conditions are combined by a logical
AND. Only resources that meet all filter conditions are returned. The values within a filter condition are combined by a logicalOR. Resources that meet any value of the filter condition are returned.For more query examples, see API Explorer.
Try it now
Test
RAM authorization
Action | Access level | Resource type | Condition key | Dependent action |
resourcecenter:SearchResources | list | *All Resource
| None | None |
Request parameters
Parameter | Type | Required | Description | Example |
NextToken | string | No | The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of | eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
MaxResults | integer | No | The maximum number of entries per page. Valid values: 1 to 500. Default value: 20. | 10 |
| Filter | array<object> | No | The filter conditions. | |
object | No | The filter condition. | ||
Key | string | No | The key of the filter condition. For more information about the valid values, see the " | RegionId |
MatchType | string | No | The matching method. Valid values:
| Equals |
| Value | array | No | The value of the filter condition. | |
string | No | The value of the filter condition. | 过滤条件值。 | |
ResourceGroupId | string | No | The ID of the resource group. | rg-acfmzawhxxc**** |
| SortCriterion | object | No | The sorting parameters. | |
Key | string | No | The sort key. Set this parameter to | CreateTime |
Order | string | No | The sort order. Valid values:
Default value: ASC. | ASC |
SearchExpression | string | No | The search keyword. Resource Center filters and sorts the search results based on relevance. If you do not specify a sorting parameter, resources that better match the keyword are displayed with higher priority. | keywords |
IncludeDeletedResources | boolean | No | Specifies whether to include deleted resources. Valid values:
| true |
Supported filter parameters
Parameter | Description | Supported matching methods |
ResourceType | The resource type. | Equals |
RegionId | The region ID. | Equals |
ResourceId | The resource ID. | Equals, Prefix |
ResourceGroupId | The resource group ID. | Equals, Exists, NotExists |
ResourceName | The resource name. | Equals, Contains |
Tag | The key-value pair of a tag. The value must be a JSON string in the | Contains, NotContains, NotExists |
VpcId | The VPC ID. | Equals |
VSwitchId | The vSwitch ID. | Equals |
IpAddress | The IP address. | Equals, Contains |
Response elements
Element | Type | Description | Example |
object | The response parameters. | ||
| Filters | array<object> | The filter conditions. | |
object | The filter condition. | ||
Key | string | The key of the filter condition. | RegionId |
MatchType | string | The matching method. | Equals |
| Values | array | The values of the filter condition. | |
string | The value of the filter condition. | cn-hangzhou | |
MaxResults | integer | The maximum number of entries returned per page. | 10 |
NextToken | string | The pagination token that is used in the next request to retrieve a new page of results. | eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd**** |
RequestId | string | The request ID. | D696E6EF-3A6D-5770-801E-4982081FE4D0 |
| Resources | array<object> | The information about the resources. | |
array<object> | The information about the resource. | ||
AccountId | string | The ID of the Alibaba Cloud account. | 151266687691**** |
CreateTime | string | The time when the resource was created. Note Whether this parameter is returned depends on the Alibaba Cloud service to which the resource belongs. | 2021-06-30T09:20:08Z |
ExpireTime | string | The time when the resource expires. | 2021-07-30T09:20:08Z |
| IpAddressAttributes | array<object> | The attributes of the IP addresses. | |
object | The attributes of the IP address. | ||
IpAddress | string | The IP address. | 192.168.1.2 |
NetworkType | string | The network type. Valid values:
| Public |
Version | string | The IP address version. | Ipv4 |
| IpAddresses | array | The IP addresses. Note Whether this parameter is returned depends on the Alibaba Cloud service to which the resource belongs. | |
string | The IP address. Note Whether this parameter is returned depends on the Alibaba Cloud service to which the resource belongs. | 192.168.1.2 | |
RegionId | string | The region ID. | cn-hangzhou |
ResourceGroupId | string | The resource group ID. | rg-acfmzawhxxc**** |
ResourceId | string | The resource ID. | vtb-bp11lbh452fr8940s**** |
ResourceName | string | The resource name. | group1 |
ResourceType | string | The resource type. | ACS::VPC::RouteTable |
| Tags | array<object> | The tags. | |
object | The tag. | ||
Key | string | The tag key. | test_key |
Value | string | The tag value. | test_value |
ZoneId | string | The zone ID. Note Whether this parameter is returned depends on the Alibaba Cloud service to which the resource belongs. | cn-hangzhou-k |
Deleted | boolean | Indicates whether the resource is deleted. Valid values:
| true |
Examples
Success response
JSON format
{
"Filters": [
{
"Key": "RegionId",
"MatchType": "Equals",
"Values": [
"cn-hangzhou"
]
}
],
"MaxResults": 10,
"NextToken": "eyJzZWFyY2hBZnRlcnMiOlsiMTAwMTU2Nzk4MTU1OSJd****\t\n",
"RequestId": "D696E6EF-3A6D-5770-801E-4982081FE4D0",
"Resources": [
{
"AccountId": "151266687691****",
"CreateTime": "2021-06-30T09:20:08Z",
"ExpireTime": "2021-07-30T09:20:08Z",
"IpAddressAttributes": [
{
"IpAddress": "192.168.1.2",
"NetworkType": "Public",
"Version": "Ipv4"
}
],
"IpAddresses": [
"192.168.1.2"
],
"RegionId": "cn-hangzhou",
"ResourceGroupId": "rg-acfmzawhxxc****",
"ResourceId": "vtb-bp11lbh452fr8940s****",
"ResourceName": "group1",
"ResourceType": "ACS::VPC::RouteTable",
"Tags": [
{
"Key": "test_key",
"Value": "test_value"
}
],
"ZoneId": "cn-hangzhou-k",
"Deleted": true
}
]
}Error codes
HTTP status code | Error code | Error message | Description |
400 | NoPermission | You are not authorized to perform this operation. | |
400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | The MaxResults parameter is invalid. |
400 | InvalidParameter.Filter.ResourceType | The specified parameter value of Filter.ResourceType is not valid. | |
409 | InvalidParameter.SortCriterion.Key | The specified parameter SortCriterion.Key is not valid. | |
409 | ExceedLimit.Filter | The maximum length of Filters is exceeded. | The number of objects specified in the Filter parameter exceeds the upper limit. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.