Applicability
Users cannot be created in the standby cluster in the current version.
Overview
You can call this API to create a database account in a specified tenant.
API details
Constraints
The caller must have an AccessKey for accessing APIs. 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 Cloud database instance. | ob317v4uif**** |
| tenantId | String | Yes | The ID of the tenant. | ob2mr3oae0**** |
Path
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase cluster. | obcluster-***** |
| tenantId | String | Yes | The ID of the tenant. | t4louaeei**** |
Body
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| userName | String | Yes | The name of the database account. Reserved keywords such as SYS and root cannot be used. | pay_test |
| password | String | Yes | The password of the database account.
NoteThe password must contain uppercase letters, lowercase letters, digits, and special characters, and must be 10 to 32 characters in length. Valid special characters: !@#$%^&*()_+-= |
!Aliyun4Oceanbase |
| userType | String | Yes | The type of the database account.
|
Normal |
| description | String | No | The description of the database. | this is a test database |
| roles | String | No | The roles of the user. | |
| encryptionType | String | No | The encryption type. | |
| 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 caller of the STS token. | |
| stsTokenCallerBid | String | No | The business ID of the caller of the STS token. | |
| acceptLanguage | String | No | The language accepted. | |
| pageNumber | Integer | No | The page number. | |
| pageSize | Integer | No | The number of items on a 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": "63d5c6c0-****-****-9feb-8e60b3073e81",
"success": true,
"server": "xxx.xxx.x.xxx:xxxx"
}
