Overview
You can call this API to query the list of databases.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. 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
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | string | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
| tenantId | string | Yes | The ID of the tenant. | ob2mr3oae0**** |
| databaseName | string | Yes | The name of the database. | databasetest |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | object | The information about the database, including the dataList attribute. | |
| dataList | object[] | The list of database information, 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. Currently, utf8mb4 and gbk are supported. | 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 been granted permissions on the database. | |
| users.role | string | The role granted to the account on the database. In OceanBase Database in MySQL mode, the role is at the database level. The roles are as follows:
|
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 'ak:sk' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/databases'
-H 'X-Ob-Project-Id: <Project ID>'
-G -d 'pageNumber=0' -d 'pageSize=20' -d'databaseName
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
}