HTTP 415 Error When Adding Attachment to Assets Object via REST API

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

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.

Environment

Jira Service Management

Diagnosis

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

(Auto-migrated image: description temporarily unavailable)

Cause

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

Solution

Change the content type to multipart/form-data instead of application/json and include the attachment in the form-data.

(Auto-migrated image: description temporarily unavailable)
(Auto-migrated image: description temporarily unavailable)

Updated on March 21, 2025

Still need help?

The Atlassian Community is here for you.