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

If the value types of request parameters are incorrect, the system returns an error response and no data is queried.

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.

Action String No DescribeDatabases

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

DBName String No test_db_4

The name of the database.

Note You cannot enter multiple database names.

Response parameters

Parameter Type Example Description
Databases Array

The list of databases.

Database

The details of each database.

Accounts Array

The list of database accounts.

Note Privileged accounts are not included.
Account

The details of each database account.

Note Privileged accounts are not included.
AccountName String test_admin

The name of the account.

Note Privileged accounts are not included.
AccountPrivilege String ReadWrite

The permissions of the database account on the database.

  • ReadWrite: read and write permissions.
  • ReadOnly: read-only permissions.
  • DMLOnly: executes only data manipulation language (DML) statements.
  • DDLOnly: executes only data definition language (DDL) statements.
AccountStatus String Available

The status of the account. Valid values:

  • Creating
  • Available
  • Deleting
PrivilegeStatus String Empowered

The permission status of the database account. Valid values:

  • Empowering: The system is granting permissions to the account.
  • Empowered: Permissions are granted to the account.
  • Removing: The system is revoking permissions for the account.
CharacterSetName String utf8

The character sets. For more information, see Character set.

DBDescription String test_db

The description of the database.

DBName String test_db_4

The name of the database.

DBStatus String Running

The status of the database. Valid values:

  • Creating
  • Running
  • Deleting
Engine String PolarDB

The engine of the cluster.

RequestId String EB88083B-AEE7-44B1-9AEB-E76337B1B236

The ID of the request.

Examples

Sample requests


http(s)://polardb.aliyuncs.com/? Action=DescribeDatabases
&DBClusterId=pc-xxxxxxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<DescribeDatabasesResponse>
      <Databases>
            <Database>
                  <Accounts>
                        <Account>
                              <AccountPrivilege>ReadWrite</AccountPrivilege>
                              <AccountStatus>Available</AccountStatus>
                              <AccountName>test_admin</AccountName>
                              <PrivilegeStatus>Empowered</PrivilegeStatus>
                        </Account>
                  </Accounts>
                  <DBStatus>Running</DBStatus>
                  <DBDescription></DBDescription>
                  <DBName>test_db_4</DBName>
                  <Engine>PolarDB</Engine>
                  <CharacterSetName>utf8</CharacterSetName>
            </Database>
      </Databases>
      <RequestId>6A83E8E9-D5C4-45CE-85CD-B0A3B2F21F5E</RequestId>
</DescribeDatabasesResponse>

JSON format

{
	"successResponse":true,
	"requestId":"EB88083B-AEE7-44B1-9AEB-E76337B1B236",
	"data":{
		"Databases":{
			"Database":[
				{
					"Accounts":{
						"Account":[
							{
								"AccountPrivilege":"ReadWrite",
								"AccountStatus":"Available",
								"AccountName":"test_a",
								"PrivilegeStatus":"Empowered"
							},
							{
								"AccountPrivilege":"ReadOnly",
								"AccountStatus":"Available",
								"AccountName":"test_acc",
								"PrivilegeStatus":"Empowered"
							}
						]
					},
					"DBStatus":"Running",
					"DBDescription":"",
					"DBName":"test_db_2",
					"Engine":"PolarDB",
					"CharacterSetName":"utf8"
				},
				{
					"Accounts":{
						"Account":[
							{
								"AccountPrivilege":"ReadWrite",
								"AccountStatus":"Available",
								"AccountName":"test_acc",
								"PrivilegeStatus":"Empowered"
							}
						]
					},
					"DBStatus":"Running",
					"DBDescription":"",
					"DBName":"test_db_5",
					"Engine":"PolarDB",
					"CharacterSetName":"utf8mb4"
				}
			]
		},
		"RequestId":"EB88083B-AEE7-44B1-9AEB-E76337B1B236"
	},
	"code":"200"
}

Error codes

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