Creating a Schema (a V3 API)
Function
This API is used to create a schema.
URI
POST /v3/{project_id}/instances/{instance_id}/databases
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID. Constraints N/A Range The value contains 32 characters. Only letters and digits are allowed. Default Value N/A |
| instance_id | Yes | String | Definition Instance ID, which uniquely identifies an instance. Constraints N/A Range The value contains 36 characters with a suffix of in09. Only letters and digits are allowed. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token. The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Schema name, which: information_schema, mysql, performance_schema, or sys |
| shard_mode | Yes | String | Sharding mode of the schema. The value can be: |
| shard_number | Yes | Integer | Number of shards in the same working mode |
| dn_instances | Yes | Array of DatabaseDnInstances objects | Data nodes associated with the schema. A maximum of 256 data nodes are supported. |
Response Parameters
Status code: 202
| Parameter | Type | Description |
|---|---|---|
| name | String | Schema name. |
| job_id | String | Workflow ID. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code |
| error_msg | String | Error message |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code |
| error_msg | String | Error message |
Example Request
POST https://cn-north-1/v3/{project_id}/instances/{instance_id}/databases
{
"name" : "mytestdb",
"shard_mode" : "cluster",
"shard_number" : 8,
"dn_instances" : [ {
"id" : "f296c394f13f48449d715bf99af07e59in01",
"user_name" : "root",
"user_password" : "PassWord_234"
} ]
} Example Response
Status code: 202
Success.
{
"name" : "mytestdb",
"job_id" : "0e20f87b-cb3a-4612-a2ae-16e3f04e1f4c"
} Status code: 400
Bad request
{
"error_code" : "DBS.280001",
"error_msg" : "Parameter error."
} Status code: 500
Server error
{
"error_code" : "DBS.280001",
"error_msg" : "Parameter error."
} Status Codes
| Status Codes | Description |
|---|---|
| 202 | Success. |
| 400 | Bad request |
| 500 | Server error |
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot