Confluence REST API Lacks DELETE Method for Attachments

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Upon reviewing the Confluence REST API Documentation for Attachments, you will note that the documentation states that the /rest/api/content/{id}/child/attachment methods are for "CRUD operations for Attachments on Content". CRUD operations implies that this should cover Copy, Read, Update and Delete in order to be truly CRUD operations-complete, however, there is no method for attachment deletion on this resource as of this writing. If you try to use a DELETE command, no return will be forthcoming using the REST API.

Cause

The cause is that the DELETE command is not available and exposed on the /rest/api/content/{id}/child/attachment/{attachmentid} resource.

Workaround

In the REST API, attachments are content. You can use the DELETE command for the attachment id on the /rest/api/content/{id} resource to delete all versions of the given attachment.

Another workaround to allow programmatic deletion of attachments is to use a third-party tool, the Confluence CLI which provides methods to removeAttachment, removeAttachmentVersion and removeAttachmentVersions and is a supported Add-on for Confluence.

Resolution

At present, there is an open issue CONF-36015 - Getting issue details... STATUS

  • (info) Please consider voting for this issue if it is important to you.

Last modified on Feb 26, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.