Overview
Use this API to list the databases of a specified tenant in pages. You can also retrieve information about the tables in each database.
API details
Constraints
Authenticate with an AccessKey ID and an AccessKey Secret. For information about obtaining these credentials, see Manage AccessKeys. For common request headers and authentication details, see Using API.
Request path
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/databasesByTenantId
Request parameters
Path
Parameter |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| instanceId | String | Yes | OceanBase cluster ID. | obcluster-**** |
| tenantId | String | Yes | Tenant ID. | t4louaeei**** |
Query
Parameter |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| withTables | Boolean | Yes | Explicitly specify true to include table information for each database or false to retrieve only the database list. |
false |
| pageNumber | String | No | Page number, specified as an integer. The default is 1. |
1 |
| pageSize | String | No | Number of records per page, specified as an integer. The default is 10. |
10 |
Response parameters
Field |
Type |
Description |
Example value |
|---|---|---|---|
| success | Boolean | Whether the request succeeded. | true |
| errorCode | String | Error code. | INVALID_PARAMETER |
| errorMessage | String | Error message. | Invalid parameter |
| data | Array | Databases on the current page. Each entry includes information such as the database name, character set, and status. When withTables is true, the response also includes table information. |
[] |
| requestId | String | Request ID. | d04eabba**** |
Examples
Request example
This example sets withTables=false to retrieve only the database list. It requests the first page with 10 records per page.
curl --digest -u '<AccessKey ID>:<AccessKey Secret>' \
--get 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/databasesByTenantId' \
--data-urlencode 'withTables=false' \
--data-urlencode 'pageNumber=1' \
--data-urlencode 'pageSize=10'
Response example
If the requested page has no records, data is an empty array.
{
"success": true,
"data": []
}