Applicability
Creating a user is not supported for a standby cluster in the current version.
Overview
You can call this API to create a database account in the specified 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
POST /api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers
Request parameters
Path
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the database instance in OceanBase Cloud. | obcluster-***** |
| tenantId | String | Yes | The ID of the tenant. | t4louaeei**** |
Query
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| requestId | String | Yes | The ID of the request. This parameter is used for tracing. | dc302d76-66b5-48d8-ab53-a035******** |
Body
Name |
Type |
Required |
Description |
Example value |
|---|---|---|---|---|
| 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 between 10 and 32 characters. The special characters are !@#$%^&*()_+-=. |
!Aliyun4Oceanbase |
| userType | String | Yes | The type of the database account.
|
Normal |
| host | String | No | The host of the user. | |
| roles | String | No | The role of the user. | |
| encryptionType | String | No | The encryption type. | |
| description | String | No | The description of the database. | this is a test database |
| globalPermissions | String | No | The global permissions. | |
| UID | String | No | The unique identifier of the user. | |
| User_ID | String | No | The ID of the user. | |
| callerType | String | No | The type of the caller. | |
| accessKeyId | String | No | The ID of the AccessKey. | |
| securityToken | String | No | The security token. | |
| callerUid | String | No | The ID of the caller. | |
| callerBid | String | No | The business ID of the caller. | |
| stsTokenCallerUid | String | No | The ID of the user who called the STS token. | |
| stsTokenCallerBid | String | No | The business ID of the user who called the STS token. | |
| acceptLanguage | String | No | The language that is accepted. | |
| pageNumber | Integer | No | The page number. | |
| pageSize | Integer | No | The number of entries on each page. | |
| mergedCallerBid | String | No | The merged business ID. |
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 '<your ak:sk>' \
--url 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/tenantUsers?requestId={requestId}' \
-H 'Content-Type: application/json' \
-H 'X-Ob-Project-Id: <Project ID>' \
--data '{"userName":"test","userType":"normal","password":"ABCabc123@@", "description":"test user"}'
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": "xxxxxx",
"success": true,
"server": "xxx.xxx.x.xxx:xxxx"
}
