Overview
You can call this API to create a tenant.
Note
To create a tenant with the specified specifications, the instance must have sufficient available resources.
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
POST /api/v2/instances/{instanceId}/tenants
Request parameters
Query
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the OceanBase instance. | ob317v4uif**** |
Body
| Name | Type | Required | Description | Example value |
|---|---|---|---|---|
| createParams | map | No | Some parameters for creating a tenant, including whether the table name is case-sensitive. The input is of the hashMap type. Example: createParams":'{"lower_case_table_names":"1"}'. |
{"lower_case_table_names":"1"} |
| enablePublicLink | Boolean | No | Specifies whether to create a public endpoint.
|
false |
| tenantName | String | Yes | The name of the tenant. The tenant name can be searched for using wildcard characters. |
pay_**** |
| description | String | No | The database description. | this is a test database |
| cpu | Integer | Yes | The size of the tenant's CPU, in cores. | 2 |
| memory | Integer | Yes | The size of the tenant's memory, in GiB. | 10 |
| unitNum | Integer | No | The number of resource distribution nodes of the tenant. This parameter is coupled with the deployment mode of the instance. For example, if the instance deployment mode is 2-2-2, the maximum number of distribution nodes is 2. | 2 |
| primaryZone | String | Yes | The primary zone of the tenant. This parameter is one of the zones in which the instance is deployed. | cn-hangzhou-h |
| tenantMode | String | Yes | The tenant mode. Valid values: Oracle and MySQL. If the database version is V4.2.1.8, V4.2.5, or V4.3.3, only HBase and Table are supported, and the tenant can only use HBase API or Table API. | Oracle |
| timeZone | String | Yes | The tenant's time zone. For more information, see DescribeTimeZones. | Asia/Shanghai |
| charset | String | Yes | The character set.
Notice
|
utf8mb4 |
Response parameters
| Name | Type | Description | Example value |
|---|---|---|---|
| data | object | Information about the tenant. | |
| tenantId | String | The ID of the tenant. | t33h8y08k**** |
Examples
Request example
curl --request POST 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants' \
--digest -u 'ak:sk' \
-H 'X-Ob-Project-Id: <Project ID>'
--data \ '{"memory":5,"cpu":2,"unitNum":1,"primaryZone":"us-east-1a","tenantName":"testAPI","tenantMode":"MySQL","charset":"utf8mb4","timeZone":"Asia/Shanghai","description":"12345"}'
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
{
"success":true,
"data":{
"tenantId":"tenant id"
},
"requestId":"uuid"
}