HTTP 415 Error When Adding Attachment to Assets Object via REST API
プラットフォームについて: Data Center のみ。 - This article only applies to Atlassian apps on the Data Center プラットフォーム。
この KB は Data Center バージョンの製品用に作成されています。Data Center 固有ではない機能の Data Center KB は、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。 Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。
*Fisheye および Crucible は除く
要約
When attempting to attach files to an existing insight object via the REST API. The operation resulted in an HTTP 415 error, indicating an unsupported media type.
環境
Jira Service Management
診断
We tried to reproduce the issue using Postman, following the instructions in the given document https://docs.atlassian.com/assets/REST/10.4.4/#attachments

原因
The issue was due to the incorrect content-type of application/json, leading to confusion regarding the API's functionality. The API actually requires multipart/form-data for file uploads, and the attachment file must be included in the form-data. Additionally, a suggestion request has been created to improve the clarity of the documentation regarding these requirements JSWSERVER-26171 - Update Rest API document for Asset object Add attachment
ソリューション
Change the content type to multipart/form-data instead of application/json and include the attachment in the form-data.


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