Delete database¶
Delete the specified database. Before executing, please confirm that the database and the data in it are no longer needed.
POST $CLOUDSIGMA_API_BASE/meta/db/drop
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.
Prepare personal access token and target workspace ID that can access the target workspace. The token must have delete database permissions.
View database, select and record the database name to be deleted.
Confirm that the database and the data in it are no longer needed.
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $DATABASE in the example with actual values.
curl -X POST "$CLOUDSIGMA_API_BASE/meta/db/drop" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d "{
\"db_name\": \"$DATABASE\"
}"
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The name of the database to delete. |
Successful response¶
{
"code": 200,
"data": null
}
Field |
Type |
Description |
|---|---|---|
code |
integer |
200 on success. |
data |
null |
This operation does not return a result object. |
Error response¶
{
"code": 400,
"message": "db_name 不能为空"
}
Field |
Type |
Description |
|---|---|---|
|
integer or string |
Error code or status code. |
|
string |
error message. |
DROP IF EXISTS is executed in autocommit mode and may succeed even if the target does not exist. If the connection fails to be released after deletion, the interface may still return an error.
After receiving an error, first use an identity with target permissions to query whether the target still exists. Do not try again directly. The empty list may also be caused by insufficient permissions, and the successful deletion cannot be confirmed based on this.