Delete File API
POST /deleteFile
Description
This API endpoint allows an admin to delete an existing file by providing the file's unique identifier. Deleting a file will remove it and its associated data from the platform.
Request Body
The request utilizes GraphQL to perform the deleteFile
mutation.
Mutation:
mutation deleteFile ($id: Int!) {
deleteFile (id: $id) {
id
title
description
url
}
}
Variables:
{
"id": 0
}
- id (Int): The unique identifier of the file to be deleted.
Response:
-
Success (200 OK):
- If the deletion is successful, the response will return the details of the deleted file, confirming that the file has been removed from the platform.
{
"data": {
"deleteFile": {
"id": "<File_ID>",
"title": "<File_Title>",
"description": "<File_Description>",
"url": "<File_URL>"
}
}
} -
Error (4XX/5XX):
- Appropriate error messages and status codes will be returned in cases of invalid file ID, missing required fields, or server errors.
Note:
Ensure that the id
corresponds to an existing file within the platform. Once deleted, the file and its data cannot be recovered, so make sure to back up any necessary information before performing this action. This API should be used by admins with the necessary permissions to manage and delete files within the platform.