You can call this operation to query the database account information of a specified ApsaraDB for PolarDB cluster.

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
DBClusterId String Yes pc-xxxxxxxxxxxxxxx The ID of the cluster.
AccessKeyId String No key-test The AccessKey ID provided to you by Alibaba Cloud.
AccountName String No testacc The name of the account.
Action String No DescribeAccounts The operation that you want to perform. Set the value to DescribeAccounts.

Response parameters

Parameter Type Example Description
Accounts Array The list of database accounts.
AccountDescription String AccDesc The description of the database account.
AccountLockState String UnLock The locking status of the account. Valid values:
  • UnLock
  • Lock
AccountName String testacc The name of the database account.
AccountStatus String Available

The status of the account. Valid values:

  • Creating
  • Available
  • Deleting
AccountType String Normal

The type of the database account. Valid values:

  • Normal: standard account
  • Super: privileged account
DatabasePrivileges Array The list of database permissions granted to the account.
Note Only permissions of standard accounts are displayed.
AccountPrivilege String ReadOnly The permissions of the database account on the database.
DBName String DBtest The name of the database.
RequestId String 16B29387-7226-4E6C-98C2-06B98FFD16D8 The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/? Action=DescribeAccounts
&DBClusterId=pc-xxxxxxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<Accounts>
    <DatabasePrivileges>
        <AccountPrivilege>ReadWrite</AccountPrivilege>
        <DBName>test2</DBName>
    </DatabasePrivileges>
    <DatabasePrivileges>
        <AccountPrivilege>ReadOnly</AccountPrivilege>
        <DBName>test3</DBName>
    </DatabasePrivileges>
    <AccountStatus>Available</AccountStatus>
    <AccountDescription/>
    <AccountName>mytest1</AccountName>
    <PrivilegeExceeded>No</PrivilegeExceeded>
    <AccountLockState>UnLock</AccountLockState>
    <AccountType>Normal</AccountType>
</Accounts>
<RequestId>F0633414-8524-4215-B0A0-789A65A0D9ED</RequestId>

JSON format

{
	"Accounts":[
		{
			"AccountStatus":"Available",
			"DatabasePrivileges":[
				{
					"AccountPrivilege":"ReadWrite",
					"DBName":"test2"
				},
				{
					"AccountPrivilege":"ReadOnly",
					"DBName":"test3"
				}
			],
			"AccountDescription":"",
			"AccountName":"mytest1",
			"PrivilegeExceeded":"No",
			"AccountLockState":"UnLock",
			"AccountType":"Normal"
		}
	],
	"RequestId":"F0633414-8524-4215-B0A0-789A65A0D9ED"
}

Error codes

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