Creating a Schema
Function
This API is used to create a schema.
Constraints
Before creating a schema, ensure that you have associated RDS instances with your DDM instance and that the RDS instances are not associated with other DDM instances.
URI
POST /v1/{project_id}/instances/{instance_id}/databases
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        project_id  | 
      
        Yes  | 
      
        String  | 
      
        Project ID of a tenant in a region  | 
     
| 
        instance_id  | 
      
        Yes  | 
      
        String  | 
      
        DDM instance ID  | 
     
Request Parameters
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        X-Auth-Token  | 
      
        Yes  | 
      
        String  | 
      
        User token It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        databases  | 
      
        Yes  | 
      
        Array of CreateDatabaseDetail objects  | 
      
        Schema information  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        name  | 
      
        Yes  | 
      
        String  | 
      
        Schema name, which: 
 Minimum length: 2 characters Maximum length: 48 characters  | 
     
| 
        shard_mode  | 
      
        Yes  | 
      
        String  | 
      
        Sharding mode of the schema. The value can be: 
 Enumerated values: 
  | 
     
| 
        shard_number  | 
      
        Yes  | 
      
        Integer  | 
      
        Number of shards in the same working mode 
  | 
     
| 
        shard_unit  | 
      
        No  | 
      
        Integer  | 
      
        Number of shards per RDS instance This parameter is optional. 
 Minimum value: 1 Maximum value: 64  | 
     
| 
        used_rds  | 
      
        Yes  | 
      
        Array of DatabaseInstabcesParam objects  | 
      
        RDS instances associated with the schema  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        databases  | 
      
        Array of CreateDatabaseDetailResponses objects  | 
      
        Schema information  | 
     
Status code: 400
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        errCode  | 
      
        String  | 
      
        Service error code  | 
     
| 
        externalMessage  | 
      
        String  | 
      
        Error message  | 
     
Status code: 500
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        errCode  | 
      
        String  | 
      
        Service error code  | 
     
| 
        externalMessage  | 
      
        String  | 
      
        Error message  | 
     
Example Request
The following is an example request of creating a schema and associating it with an existing DDM account.
POST https://{endpoint}/v1/{project_id}/instances/{instance_id}/databases
{
  "databases" : [ {
    "name" : "mytestdb",
    "shard_mode" : "cluster",
    "shard_number" : 8,
    "shard_unit" : 8,
    "used_rds" : [ {
      "id" : "f296c394f13f48449d715bf99af07e59in01",
      "adminUser" : "root",
      "adminPassword" : "PassWord_234"
    } ]
  } ]
}
 Example Response
Status code: 200
OK
{
  "databases" : [ {
    "name" : "mytestdb"
  } ]
}
  Status code: 400
bad request
{
  "externalMessage" : "Parameter error.",
  "errCode" : "DBS.280001"
}
  Status code: 500
server error
{
  "externalMessage" : "Server failure.",
  "errCode" : "DBS.200412"
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        OK  | 
     
| 
        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.