Queries the accounts created on an ApsaraDB for RDS instance.

Note If the instance is running SQL Server 2017 and the Cluster Edition, PostgreSQL, or PPAS, this operation is not supported.

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 DescribeAccounts

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

AccountName String No test1

The name of the specific account to query.

PageSize Integer No 30

The number of entries to return on each page. Default value: 30.

PageNumber Integer No 1

The number of the page to return. Pages start from page 1.

Default value: 1.

Response parameters

Parameter Type Example Description
RequestId String A2E94301-D07F-4457-9B49-6AA2BB388C85

The ID of the request.

SystemAdminAccountStatus String True

Indicates whether superuser accounts are enabled.

SystemAdminAccountFirstActivationTime String 2020-02-06T11:00:00Z

The first time when superuser accounts were enabled. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

Note If you set the SysadminAccount parameter to True, a value is returned. Otherwise, an empty string is returned.
Accounts Array

An array that consists of accounts.

DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance to which the account belongs.

AccountName String test1

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: The account is a standard account.
  • Super: The account is a privileged account.
  • Sysadmin: The account is a superuser account that has the system administrator permissions.
AccountDescription String Test account

The description of the account.

PrivExceeded String 0

Indicates whether the number of databases that are managed by the account exceeds the specified quota. Valid values:

  • 1: The number of databases that are managed by the account exceeds the specified quota.
  • 0: The number of databases that are managed by the account does not exceed the specified quota.
DatabasePrivileges Array

An array of permissions that are granted to the account.

DBName String test1

The name of the database.

AccountPrivilege String ReadWrite

The type of permission granted to the account. Valid values:

  • ReadWrite: The account has the read/write permissions on the database.
  • ReadOnly: The account has the read-only permissions on the database.
  • DDLOnly: The account has the DDL-only permissions on the database.
  • DMLOnly: The account has the DML-only permissions on the database.
  • Custom: You can modify the permissions of the account by using SQL commands.
AccountPrivilegeDetail String SELECT,INSERT

The operations that the account is authorized to perform on the database. For more information, see Account permissions.

Examples

Sample requests

http(s)://rds.aliyuncs.com/? Action=DescribeAccounts
&DBInstanceId=rm-uf6wjk5xxxxxxx
&<Common request parameters>

Sample success responses

XML format

<DescribeAccountsResponse>
      <Accounts>
            <DBInstanceAccount>
                  <DatabasePrivileges>
                        <DatabasePrivilege>
                              <AccountPrivilege>ReadWrite</AccountPrivilege>
                              <AccountPrivilegeDetail>SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES,CREATE VIEW,SHOW VIEW,CREATE ROUTINE,ALTER ROUTINE,EXECUTE,EVENT,TRIGGER</AccountPrivilegeDetail>
                              <DBName>testdb</DBName>
                        </DatabasePrivilege>
                  </DatabasePrivileges>
                  <AccountStatus>Available</AccountStatus>
                  <AccountDescription></AccountDescription>
                  <DBInstanceId>rm-uf6wjk5xxxxxxx</DBInstanceId>
                  <AccountName>testacc02</AccountName>
                  <PrivExceeded>0</PrivExceeded>
                  <AccountType>Normal</AccountType>
            </DBInstanceAccount>
      </Accounts>
      <RequestId>A2E94301-D07F-4457-9B49-6AA2BB388C85</RequestId>
</DescribeAccountsResponse>

JSON format

{
    "Accounts": {
        "DBInstanceAccount": [
            {
                "DatabasePrivileges": {
                    "DatabasePrivilege": [
                        {
                            "AccountPrivilege": "ReadWrite",
                            "AccountPrivilegeDetail": "SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,INDEX,ALTER,CREATE TEMPORARY TABLES,LOCK TABLES,CREATE VIEW,SHOW VIEW,CREATE ROUTINE,ALTER ROUTINE,EXECUTE,EVENT,TRIGGER",
                            "DBName": "testdb"
                        }
                    ]
                },
                "AccountStatus": "Available",
                "AccountDescription": "",
                "DBInstanceId": "rm-uf6wjk5xxxxxxx",
                "AccountName": "testacc02",
                "PrivExceeded": "0",
                "AccountType": "Normal"
            }
        ]
    },
    "RequestId": "A2E94301-D07F-4457-9B49-6AA2BB388C85"
}

Error codes

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