Delete File

  • Is able to remove a file which is stored in a File or FileList property.

  • Required security permission - MODIFY.

  • HTTP methods supported: POST

Description

Some properties of an object may be allowed to store files. The files themselves are stored in a MongoDB GridFS bucket. The files can be deleted using this endpoint.

On success, this endpoint returns the metadata table of the deleted file. In case the file didn’t exist, the value of the metadata field in the response will be null.

Parameters

Name Type Optional Description

pathspec

string

yes

Path or id of the File or FileList property which holds the file to be deleted.

filter

string

Maybe

The name of the file to be deleted. Optional if pathspec refers to a property of type File.

scope_comment

string

yes

Audit trail comment.

insights

boolean

yes

Indicates application insights should be included in the response. By default false.

Examples

Deleting a file from a FileList property

HTTP POST

Request URL
  • /api/v2/deletefile

Request Body
{
  "pathspec": "/Enterprise.Attachments",
  "filter": "example.svg"
}
Response body
{
    "data": {
        "metadata": {
            "_dbref": "8b18c8da9355e38daf6c935b4921d2ad8b2ef1cac4c2fbeebfd8af9946a91574",
            "custom": {
                "lorum": "ipsum"
            },
            "dateuploaded": 1622758226545,
            "extension": "svg",
            "name": "example.svg",
            "size": 2149
        }
    }
}

Trying to delete a file which does not exist.

HTTP POST

Request URL
  • /api/v2/deletefile

Request Body
{
  "pathspec": "/Enterprise.Attachments",
  "filter": "example.svg"
}
Response body
{
    "data": {
        "metadata": null
    }
}