Create database¶
Create a database under the specified Catalog.
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¶
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 |
|---|---|---|---|
|
integer |
Yes |
Parent Catalog ID. |
|
string |
Yes |
Database name, must be a valid identifier. |
|
string |
No |
Database description. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": 2
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
integer or null |
Create a new database ID. When not provided by the server, it is |
Error response¶
{
"code": "ErrAlreadyExists",
"msg": "数据库名称已存在"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
error message. |