Applicability
Users cannot be created in a standby cluster in the current version.
Overview
You can call this API to create a database account under a specified tenant.
API details
Constraints
The caller must have an AccessKey for accessing the APIs of OceanBase Cloud. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers
Request parameters
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase cluster. | ob317v4uif**** |
| tenantId | String | Yes | The ID of the tenant. | ob2mr3oae0**** |
Body
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| userType | String | Yes | The type of the database account.
|
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 contain uppercase letters, lowercase letters, digits, and special characters. The length of the password must be 10 to 32 characters. Valid special characters: !@#$%^&*()_+-= |
!Aliyun4Oceanbase |
| description | String | No | The description of the database account. | this is a test database |
Response parameters
| Name | 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.
|
ONLINE |
| userType | String | The type of the database account.
|
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
}