Overview
You can call this API to query the database list of a specified OceanBase cluster tenant. You can filter the query results by database name and support pagination. The returned result contains the database name, character set, status, creation time, and list of users who have permissions on the database.
API details
Constraints
The caller must have an AccessKey for accessing the APIs of OceanBase Cloud. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
GET /api/v2/instances/{instanceId}/tenants/{tenantId}/databases
Request parameters
Path parameters
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OceanBase Cloud instance. | obcluster-***** |
| tenantId | string | Yes | The ID of the tenant. | t4louaeei**** |
Query parameters
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| databaseName | string | No | The name of the database. This parameter is used to filter the query results. | test_db |
| pageNumber | integer | No | The page number. | 1 |
| pageSize | integer | No | The number of entries per page. | 20 |
| requestId | string | Yes | The request ID for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | object | The database information, including the dataList attribute. | |
| dataList | object[] | The database information list, including the following attributes. | |
| databaseName | string | The name of the database. | databasetest |
| description | string | The description of the database. | 1**** |
| encoding | string | The encoding of the database. Valid values: utf8mb4 and gbk. | utf8mb4 |
| gmtCreate | string | The creation time. | 2023-08-29T03:43:52Z |
| status | string | The status of the database.
|
ONLINE |
| tenantId | string | The ID of the tenant. | t50qhutdr**** |
| users | object[] | The list of accounts that have permissions on the database. | |
| users.role | string | The role permission granted to the account. In OceanBase Database in MySQL mode, the role is at the database level and has the following types:
|
ReadWrite |
| users.userName | string | The name of the account. | test2 |
| users.userType | string | The type of the account.
|
Normal |
Examples
Request example
curl --request GET \
--digest -u '<your ak:sk>' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/databases?databaseName={databaseName}&pageNumber={pageNumber}&pageSize={pageSize}&requestId={requestId}' \
-H 'X-Ob-Project-Id: <Project ID>'
Note
- A project ID uniquely identifies a project. For information about how to obtain the project ID of an instance, see Manage projects.
- Make sure that the project ID corresponding to the specified instanceId is consistent with the specified project ID.
Response example
JSON format
{
"data":{
"dataList":[
{
"databaseName":"databasetest",
"description":"123456",
"encoding":"utf8mb4",
"gmtCreate":"2023-08-29T03:43:52Z",
"status":"ONLINE",
"tenantId":"t50qhutdrc5gg",
"users":[
{
"role":"readwrite",
"userName":"test2",
"userType":"Normal"
}
]
}
],
"total":1
},
"requestId":"ded0298e-e422-4e29-ada9-85952a8342cc",
"success":true
}
