You can call this API to query all accounts or a specified account of an ApsaraDB for Redis instance.

Note The engine version of the ApsaraDB for Redis instance must be Redis 4.0 or above.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for APIs, call APIs, and dynamically generate SDK example code.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeAccounts

The operation that you want to perform. Set this parameter to DescribeAccounts.

InstanceId String Yes r-bp1xxxxxxxxxxxxx

The ID of the instance to which the account belongs.

AccessKeyId String No Lxxxxxxxxxxxxxxw

The AccessKey ID that Alibaba Cloud provides for you to access services.

AccountName String No demoaccount

The name of the account. The name must start with a lowercase letter and can contain lowercase letters, digits, and underscores (_). The name can be 1 to 16 characters in length.

Response parameters

Parameter Type Example Description
Accounts

The accounts that were queried.

└AccountDescription String this is a test account

The description of the account.

└AccountName String demoaccount

The name of the account.

└AccountStatus String Available

The status of the account. Valid values:

  • Unavailable
  • Available
└AccountType String Normal

The type of the account. Valid values:

  • Normal
  • Super
└DatabasePrivileges

The permissions of the account.

└AccountPrivilege String RoleReadWrite

The permission of the account. Valid values:

  • RoleReadOnly
  • RoleReadWrite (default value)
  • RoleRepl
Note In addition to reading data from and writing data to the ApsaraDB for Redis instance, an account with the RoleRepl permission can run the SYNC and PSYNC commands.
└InstanceId String r-bp1xxxxxxxxxxxxx

The ID of the instance.

RequestId String 6C9E114C-217C-4118-83C0-B40702221161

The ID of the request.

Examples

Sample request


https://r-kvstore.aliyuncs.com/
? Action=DescribeAccounts
&InstanceId=r-bp1xxxxxxxxxxxxx
&<Common request parameters>

Sample success response

XML format

<DescribeAccountsResponse>
  <Accounts>
    <Account>
      <DatabasePrivileges>
        <DatabasePrivilege>
          <AccountPrivilege>RoleReadWrite</AccountPrivilege>
        </DatabasePrivilege>
      </DatabasePrivileges>
      <AccountStatus>Available</AccountStatus>
      <InstanceId>r-bp1xxxxxxxxxxxxx</InstanceId>
      <AccountName>r-bp1xxxxxxxxxxxxx</AccountName>
      <PrivExceeded>0</PrivExceeded>
      <AccountType>Normal</AccountType>
    </Account>
  </Accounts>
  <RequestId>6C9E114C-217C-4118-83C0-B40702221161</RequestId>
</DescribeAccountsResponse>

JSON format

{
	"Accounts":{
		"Account":[
			{
				"AccountStatus":"Available",
				"DatabasePrivileges":{
					"DatabasePrivilege":[
						{
							"AccountPrivilege":"RoleReadWrite"
						}
					]
				},
				"InstanceId":"r-bp1xxxxxxxxxxxxx",
				"AccountName":"r-bp1xxxxxxxxxxxxx",
				"PrivExceeded":"0",
				"AccountType":"Normal"
			}
		]
	},
	"RequestId":"6C9E114C-217C-4118-83C0-B40702221161"
}

Error codes

View error codes.