Create database

Create a database under the specified Catalog.

HTTP
POST $CLOUDSIGMA_API_BASE/catalog/database/create

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the catalog list to obtain the parent catalog ID. Prepare the personal access token, target workspace ID, and parent Catalog ID that can access the target workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/catalog/database/create" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
    "catalog_id": '"$CATALOG_ID"',
    "name": "<DATABASE_NAME>",
    "description": "<DATABASE_DESCRIPTION>"
  }'

Field

Type

Required

Description

catalog_id

integer

Yes

Parent Catalog ID.

name

string

Yes

Database name, must be a valid identifier.

description

string

No

Database description.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": 2
  }
}

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.id

integer or null

Create a new database ID. When not provided by the server, it is null.

Error response

JSON
{
  "code": "ErrAlreadyExists",
  "msg": "数据库名称已存在"
}

Field

Type

Description

code

string

error code.

msg

string

error message.

Last updated on