Skip to main content

pages/{pageid}/files/{filename} (DELETE)


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


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 (archive/files/{fileid} (DELETE)) or restored (archive/files/restore/{fileid} (POST)).

Use files/{fileid} (GET) to retrieve a list of files across the site or pages/{pageid}/files (GET) to retrieve the files on a specified page.

C# Code Sample: Delete a File

The following code example deletes myfile.jpg from the home page:

Sample Code

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
p.At("pages", "home", "files", "=myfile%252ejpg").Delete();

Implementation notes 

Add notes about requirements or config values

Curl Code Sample: Delete a File from a Page

The following command deletes file "foo" from page "bar". Note that the file is placed in the archive where it can either be restored or permanently deleted.

Sample Code

curl -u admin:password -X DELETE -i http://mindtouch.address/@api/deki/pages/=bar/files/=foo

Implementation notes 

curl flags

Provides external user authentication.
Specifies the HTTP request method.
Outputs the HTTP response headers. Useful for debugging.
  • Was this article helpful?