Applicability
Creating a user in a standby instance is not supported in the current version.
Overview
You can call this API to create a database account 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 |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase instance. | ob317v4uif**** |
| tenantId | String | Yes | The ID of the tenant. | ob2mr3oae0**** |
Body
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| userType | String | Yes | The type of the database account. Valid values:
|
Normal |
| userName | String | Yes | The name of the database account. You cannot use reserved keywords, such as SYS and root. | pay_test |
| password | String | Yes | The password of the database account.
NoteThe password must be 10 to 32 characters in length and contain any three of the following categories: uppercase letters, lowercase letters, digits, and special characters. The supported special characters are |
!Cloud4Oceanbase |
| description | String | No | The description of the database. | This is a test database |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| data | Object | The information about the tenant. | |
| userName | String | The name of the database account. | 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 --request POST \
--digest -u 'ak:sk' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers' \
-H 'X-Ob-Project-Id: <Project ID>'
--data '{"userName":"test","userType":"normal","password":"ABCabc123@@"}'
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":{
"userName":"test",
"userStatus":"ONLINE",
"userType":"normal"
},
"requestId":"63d5c6c0-****-****-9feb-8e60b3073e81",
"success":true
}