Confluence REST API Lacks DELETE Method for Attachments

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。

このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

症状

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.

原因

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

回避策

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.

ソリューション

This is a known issue; it has been resolved in Confluence v9.0.1 and newer: CONFSERVER-36015 - REST API Needs ability to remove specific versions of an attachment.

最終更新日: 2025 年 1 月 23 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.