Delete database¶
Delete the specified database. Before deleting, make sure the database is not used by publishing or subscription.
POST https://moi.matrixorigin.cn/newmoi/catalog/database/delete
Preparation before calling¶
First query the database list to obtain the database ID. Prepare the personal access token, target workspace ID, and database ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$DATABASE_ID: Database ID to delete.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/database/delete" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"id": '"$DATABASE_ID"'
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
The ID of the database to delete. |
Successful response¶
Returns 200 on success, data is null.
{
"code": "OK",
"msg": "OK",
"data": null
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
null |
|
Error response¶
{
"code": "ErrDatabasePublished",
"msg": "数据库已发布",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body or database ID is invalid. |
Use the database ID returned by the list. |
|
|
The current identity does not have permission to delete. |
Use authorized credentials. |
|
|
The database is published, is a subscription library, or is subject to read-only restrictions. |
Handle the publish or subscribe relationship first. |
|
|
The server failed to delete the database. |
Log the error message and try again. |