Overview
You can call this API to query all database accounts 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}/tenantUsers
Request parameters
Query
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| searchKey | String | No | The keyword used for the query. | pay |
| userName | String | No | The name of the database account. You cannot use reserved keywords, such as SYS and root. | pay_test |
| instanceId | String | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
| tenantId | String | Yes | The ID of the tenant. | ob2mr3oae0**** |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| data | Object | The information about the database accounts of the tenant, including the dataList parameter. | |
| dataList | Object[] | The list of information about the database accounts, including the following parameters. | |
| databases | Object[] | The information about the databases managed by the account. If this parameter in the response is empty, no database is managed by the account. This parameter is left empty for the super administrator account. |
|
| databases.database | String | The name of the database managed by the account. | default_database |
| databases.role | String | The role of the account. In the Oracle compatible mode, a role is a schema-level role. Valid values:
NoteBy default, an account in the Oracle compatible mode has the read and write privileges on its own schema, which is not described in detail here. |
ReadOnly |
| databases.userName | String | The name of the database account. | test |
| databases.withGrant | boolean | Indicates whether the account is authorized to grant privileges to other accounts.
|
0 |
| description | String | The description of the database account. | use for test |
| userStatus | String | The status of the database account. Valid values:
|
ONLINE |
| userType | String | The type of the database account. Valid values:
|
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
}