How to add an attachment to an Insight Object using 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
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:
1
2
3
4
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 is available on Insight REST API.
Was this helpful?