Queries resource groups.

In this example, the resource groups within the current account are queried. The returned result shows that two resource groups exist within the current account.

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 ListResourceGroups

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

Status String No OK

The statuses of the resource groups. Valid values:

  • Creating: The resource groups are being created.
  • OK: The resource groups are created.
  • PendingDelete: The resource groups are waiting to be deleted.
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 2

The total number of entries returned.

RequestId String 4B450CA1-36E8-4AA2-8461-86B42BF4CC4E

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.

ResourceGroups Array of ResourceGroup

The information of the resource groups.

ResourceGroup
DisplayName String my-project

The display name of the resource group.

Status String OK

The status of the resource group. Valid values:

  • Creating: The resource group is being created.
  • OK: The resource group is created.
  • PendingDelete: The resource group is waiting to be deleted.
AccountId String 123456789****

The ID of the Alibaba Cloud account to which the resource group belongs.

Name String my-project

The unique identifier of the resource group.

CreateDate String 2015-01-23T12:33:18Z

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

Id String rg-9gLOoK****

The ID of the resource group.

Examples

Sample requests

https://resourcemanager.aliyuncs.com/?Action=ListResourceGroups
&<Common request parameters>

Sample success responses

XML format

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

<?xml version="1.0" encoding="UTF-8" ?>
<ListResourceGroupsResponse>
	<RequestId>4B450CA1-36E8-4AA2-8461-86B42BF4CC4E</RequestId>
	<PageNumber>1</PageNumber>
	<PageSize>10</PageSize>
	<TotalCount>2</TotalCount>
	<ResourceGroups>
		<ResourceGroups>
			<Id>rg-1hSBH2****</Id>
			<AccountId>123456789****</AccountId>
			<Name>default</Name>
			<DisplayName>Default resource group</DisplayName>
			<Status>OK</Status>
			<CreateDate>2015-01-23T12:33:18Z</CreateDate>
		</ResourceGroups>
		<ResourceGroups>
			<Id>rg-9gLOoK****</Id>
			<AccountId>123456789****</AccountId>
			<Name>my-project</Name>
			<DisplayName>my-project</DisplayName>
			<Status>OK</Status>
			<CreateDate>2015-01-23T12:33:18Z</CreateDate>
		</ResourceGroups>
	</ResourceGroups>
</ListResourceGroupsResponse>

JSON format

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

{
  "RequestId" : "4B450CA1-36E8-4AA2-8461-86B42BF4CC4E",
  "PageNumber" : 1,
  "PageSize" : 10,
  "TotalCount" : 2,
  "ResourceGroups" : {
    "ResourceGroups" : [ {
      "Id" : "rg-1hSBH2****",
      "AccountId" : "123456789****",
      "Name" : "default",
      "DisplayName" : "Default resource group",
      "Status" : "OK",
      "CreateDate" : "2015-01-23T12:33:18Z"
    }, {
      "Id" : "rg-9gLOoK****",
      "AccountId" : "123456789****",
      "Name" : "my-project",
      "DisplayName" : "my-project",
      "Status" : "OK",
      "CreateDate" : "2015-01-23T12:33:18Z"
    } ]
  }
}

Error codes

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