Delete files¶
Delete the specified file.
POST https://moi.matrixorigin.cn/newmoi/catalog/file/delete
Preparation before calling¶
First query the file list to obtain the target file ID and the volume ID to which it belongs. Prepare the personal access token, target workspace ID, file ID, and volume ID that has 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.$FILE_ID: File ID to delete.$VOLUME_ID: ID of the volume to which the file belongs.
This action removes the file association and deletes the file irreversibly.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/catalog/file/delete" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": "'"$FILE_ID"'",
"volume_id": "'"$VOLUME_ID"'"
}'
Request body¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
File ID. |
|
string |
Yes |
The volume ID to which the file belongs. |
Successful response¶
Returns 200 on success, data is null. This operation removes the file association and deletes the file irreversibly.
{
"code": "OK",
"msg": "OK",
"data": null
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
null |
Fixed to |
Error response¶
{
"code": "ErrNotFound",
"msg": "对象不存在",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Check file ID and owning volume ID. |
|
|
The current identity does not have write permissions on the root volume to which it belongs. |
Use credentials with write access, or contact your administrator for authorization. |
|
|
The file or the volume it belongs to does not exist. |
Check file ID and volume ID. |
|
|
The volume where the file is located is not writable. |
Select files in a writable volume. |
|
|
The service cannot delete the file. |
Record the request time and error message and try again; if it continues to fail, contact support. |
Follow-up operations¶
Query file products, confirm that the target no longer appears.