Overview
You can call this API to query the databases in a tenant.
API details
Constraints
The caller must have an AccessKey for accessing 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
Query
| Parameter | 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
| Parameter | Type | Description | Example value |
|---|---|---|---|
| data | Object | The database information, including the dataList parameter. | |
| dataList | Object[] | The list of information about the database, including the following parameters. | |
| databaseName | String | The name of the database. | databasetest |
| description | String | The description of the database. | 1**** |
| encoding | String | The encoding format of the database. At present, the utf8mb4 and gbk encoding formats are supported. | utf8mb4 |
| gmtCreate | String | The time when the database was created. | 2023-08-29T03:43:52Z |
| status | String | The status of the database. Valid values:
|
ONLINE |
| tenantId | String | The ID of the tenant. | t50qhutdr**** |
| users | Object[] | The list of accounts that are granted privileges on this database. | |
| users.role | String | The role of the account. In the MySQL compatible mode, a role is a database-level role. Valid values:
|
ReadWrite |
| users.userName | String | The name of the account. | test2 |
| users.userType | String | The type of the account. Valid values:
|
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=databasetest'
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
}