Overview
You can call this API to query the list of database accounts in a tenant.
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}/tenantUsers
Request parameters
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| searchKey | string | No | The keyword for filtering the list. | pay |
| userName | string | No | The name of the database account. Reserved keywords such as SYS and root cannot be used. | pay_test |
| instanceId | string | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
| tenantId | string | Yes | The ID of the tenant. | ob2mr3oae0**** |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | object | The information about the database accounts, including the dataList field. | |
| dataList | object[] | The list of database accounts, including the following fields. | |
| databases | object[] | The information about the databases managed by the account. This field may be empty, indicating that the account does not manage any databases. For a super account, this field is empty. |
|
| databases.database | string | The name of the database managed by the account. | default_database |
| databases.role | string | The privileges of the account. For an Oracle account, the role is at the schema level and can be
NoteFor an Oracle account, default read and write privileges are granted to its own schema. Therefore, this field is not displayed. |
ReadOnly |
| databases.userName | String | The name of the database account. | test |
| databases.withGrant | boolean | Indicates whether the account has the grant privilege:
|
0 |
| description | string | The description of the database account. | use for test |
| userStatus | String | The status of the database account:
|
ONLINE |
| userType | String | The type of the database account:
|
Normal |
Examples
Request example
curl -v --location \
--request GET \
--digest -u 'ak:sk' \
-G -d 'pageNumber=0' -d 'pageSize=20' -d'searchKey=xxx' -d'userName=xxx' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers'
-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":[
{
"databases":[
{
"database":"default_database",
"role":"readwrite",
"userName":"test",
"withGrant":0
}
],
"description":"this is description",
"userName":"test",
"userStatus":"ONLINE",
"userType":"Normal"
}
],
"total":1
},
"requestId":"ff75767c-5010-4ee3-8029-a47d3052ec63",
"success":true
}