How to add an attachment to an Insight Object using REST API
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
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
Purpose
This article walks through the process of uploading an attachment to an Insight Object via the REST API.
Solution
Attachment can be added to Insight Object by using /rest/insight/1.0/attachments/object/<objectID> Given below is a sample Example:
curl -D- -u <username>:<password> -X POST -H "X-Atlassian-Token: nocheck" -F "file=@<File_Path>" http://<base-url>/rest/insight/1.0/attachments/object/<objectID>
Example:
curl -D- -u admin:jira -X POST -H "X-Atlassian-Token: nocheck" -F "file=@/root/Rest-api/test-attachment" http://192.168.0.108:20201/rest/insight/1.0/attachments/object/1
More information are available on Insight REST API