Overview
You can call this API to query all database users 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
| Parameter | 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**** |
| userName | string | No | The name of the database user. You cannot use reserved keywords such as SYS and root. | pay_test |
| pageNumber | integer | No | The page number. | 1 |
| pageSize | integer | No | The number of items per page. | 20 |
| searchKey | string | No | The keyword to filter the query results. | pay |
| requestId | string | Yes | The ID of the request, which is used for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| data | object | The information about the tenant user, including the dataList field. | |
| dataList | object[] | The information about the tenant user, including the following fields. | |
| databases | object[] | The information about the databases managed by the user. This field may be empty, indicating that the user does not manage any databases. The database field is empty for the super administrator. | |
| databases.database | string | The name of the database managed by the user. | default_database |
| databases.role | string | The permissions of the user. For Oracle-compatible mode, the role is at the schema level and can be
NoteIn Oracle-compatible mode, the user has default read and write permissions for its own schema. This information is not listed here. |
ReadOnly |
| databases.userName | String | The name of the database user. | test |
| databases.withGrant | boolean | Whether the user has the grant permission:
|
0 |
| description | string | The description of the database user. | use for test |
| userStatus | String | The status of the database user:
|
ONLINE |
| userType | String | The type of the database user:
|
Normal |
Examples
Request example
curl -v --location \
--request GET \
--digest -u '<Your AccessKey ID:AccessKey secret>' \
-H 'X-Ob-Project-Id: <Project ID>' \
-G \
-d 'requestId={requestId}' \
-d 'userName={userName}' \
-d 'pageNumber={pageNumber}' \
-d 'pageSize={pageSize}' \
-d 'searchKey={searchKey}' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers'
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",
"server": "xxx.xxx.x.xxx:xxxx",
"success": true
}
