Queries resource groups.
Operation description
You can call this API operation to query all resource groups within the current account. You can also call this API operation to query a specific resource group based on the status, ID, identifier, or display name of the resource group.
This topic provides an example on how to call the API operation to query the basic information about the resource groups rg-1hSBH2****
and rg-9gLOoK****
within the current account.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
Status | string | No | The status of the resource group. This parameter specifies a filter condition for the query. Valid values:
| OK |
PageNumber | integer | No | The number of the page to return. Pages start from page 1. Default value: 1. | 1 |
PageSize | integer | No | The number of entries to return on each page. Valid values: 1 to 100. Default value: 10. | 10 |
ResourceGroupId | string | No | The ID of the resource group. This parameter specifies a filter condition for the query. The ID can be a maximum of 18 characters in length and must start with Note
This parameter is incorporated into the ResourceGroupIds parameter. If you configure both the ResourceGroupId and ResourceGroupIds parameters, the value of the ResourceGroupIds parameter prevails.
| rg-9gLOoK**** |
DisplayName | string | No | The display name of the resource group. This parameter specifies a filter condition for the query. Fuzzy match is supported. The display name can be a maximum of 50 characters in length. | my-project |
Name | string | No | The identifier of the resource group. This parameter specifies a filter condition for the query. Fuzzy match is supported. The identifier can be a maximum of 50 characters in length and can contain letters, digits, and hyphens (-). | my-project |
Tag | object [] | No | The tag. This parameter specifies a filter condition for the query. | |
Key | string | No | The tag key. | k1 |
Value | string | No | The tag value. | v1 |
IncludeTags | boolean | No | Specifies whether to return the information of tags. Valid values:
Note
If you configure the Tag parameter, the system returns the information of tags regardless of the setting of the IncludeTags parameter.
| false |
ResourceGroupIds | array | No | The IDs of the resource groups. This parameter specifies a filter condition for the query. You can specify a maximum of 100 resource group IDs. Note
If you configure both the ResourceGroupId and ResourceGroupIds parameters, the value of the ResourceGroupIds parameter prevails.
| |
string | No | {"rg-1hSBH2****","rg-9gLOoK****"} |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"TotalCount": 2,
"RequestId": "4B450CA1-36E8-4AA2-8461-86B42BF4CC4E",
"PageSize": 10,
"PageNumber": 1,
"ResourceGroups": {
"ResourceGroup": [
{
"DisplayName": "my-project",
"Status": "OK",
"AccountId": "123456789****",
"Name": "my-project",
"CreateDate": "2015-01-23T12:33:18Z",
"Id": "rg-9gLOoK****",
"Tags": {
"Tag": [
{
"TagKey": "k1",
"TagValue": "v1"
}
]
}
}
]
}
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|