I have a custom HTML form on Confluence that allows users to enter information and automatically creates an issue on JIRA using the REST API. This works perfectly by making a POST to Confluence's jira-integration API:
However, this doesn't work at all for attachments. According to the JIRA Cloud API documentation, this should be possible by making a multipart/form POST, with the 'X-Atlassian-Token: no-check' header to:
This does not work when at all when made through the jira-integration API, with the server returning a 415 Unsupported Media Type.
I've confirmed that i'm sending the correct HTTP request via Postman and curl, but both return the same 415, leading me to question whether or not this is actually possible with the REST API?
Here's the complete curl i'm using:
curl -D- -u admin:admin -X POST -H "X-Atlassian-Token: no-check" -F "file=@B2B.png" 'https://[confluence-domain]/rest/jira-integration/1.0/issues?applicationId=ffbb9c48-84c6-318d-96fc-36722f84a9cf&path=https://[jira-domain]/rest/api/2/issue/TEST-2384/attachments'
And here's the server response:
HTTP/1.1 100 Continue
HTTP/1.1 415 Unsupported Media Type
Set-Cookie: JSESSIONID=7F98DA97EAF0E414F802A885A288237C; Path=/; Secure; HttpOnly
Date: Sun, 09 Sep 2018 03:20:22 GMT
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events