Skip to main content
NICE CXone Expert

Scheduled CxOne Expert Maintenance - Oct 26th 11:59 pm PT - Learn More

Expert Success Center

files/{fileid} (DELETE)

Overview

Delete file attachment

  • REST Method: DELETE
  • Method Access: public

Uri Parameters

Name Type Description
fileid int identifies a file by ID
filename string Double uri-encoded file name. Should be prefixed with "=" if it does not have an extension.
pageid string either an integer page ID, "home", or "=" followed by a double uri-encoded page title

Query Parameters

Name Type Description
authenticate bool? Force authentication for request (default: false)
redirects int? If zero, do not follow page redirects (only applies when {pageid} is present).

Return Codes

Name Value Description
OK 200 The request completed successfully
Bad Request 400 Invalid input parameter or request body
Forbidden 403 Update access to the page is required
Not Found 404 The requested file could not be found

Message Format

None

Implementation Notes

When a file is deleted, it is moved into the archive. It will remain in the archive until it is either permanently deleted (DELETE:archive/files/{fileid}) or restored (POST:archive/files/restore/{fileid}).  While a file is in the archive, it cannot be modified.
Use GET:files to retrieve a list of files across the site or GET:pages/{pageid}/files to retrieve the files on a specified page.

C# Code Sample: Delete a File

The following code example deletes file with ID 456

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki"); p.At("users", "authenticate").WithCredentials("admin", "password").Get(); p.At("files", "456").Delete();

Curl Code Sample: Delete a File

The following command removes an attachment (file ID = 1). The file is placed in the archive where it can be restored or permanently deleted.

Sample Code

curl -u username:password -X DELETE -i http://mindtouch.address/@api/deki/files/1

Implementation notes 

curl flags

-u
Provides external user authentication.
-X
Specifies the HTTP request method.
-i
Outputs the HTTP response headers. Useful for debugging.

Other Code Sample: REBOL delete file

The following code example deletes file with ID 456, and uses the modified http protocol found here.

Sample Code

read/custom [
    scheme: 'http     host: http://deki-hayes
    port-id: 80
    target: "@api/deki/files/456"
    user: "admin"
    pass: "password"
] [ DELETE "" ]

 

  • Was this article helpful?