Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Add an attachment to JIRA from Confluence using REST API

Robert Almendarez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 8, 2018

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:

[confluence-domain]/rest/jira-integration/1.0/issues?applicationId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

 

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:

[jira-domain]/rest/api/2/{issueOrKey}/attachments

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
Server: Apache-Coyote/1.1
X-ASEN: SEN-9445026
X-Confluence-Cluster-Node: 4bd404ad
X-Confluence-Cluster-Node-Name: confluence01
Set-Cookie: JSESSIONID=7F98DA97EAF0E414F802A885A288237C; Path=/; Secure; HttpOnly
X-Seraph-LoginReason: OK
X-AUSERNAME: admin
X-Content-Type-Options: nosniff
Content-Length: 0
Date: Sun, 09 Sep 2018 03:20:22 GMT
Connection: close

 

1 answer

0 votes
LostInMadness Forever December 2, 2019

Do you  have an exemple in vb or in c plsss ? 

2weekends and i have try everythig, nothing works here...

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, aafp, jira migration, marketing collaboration, end siloed work, streamline workflows, kerrie gottschalk, jira cloud admins, unified marketing, process visibility, team efficiency, cross-team collaboration

How Kerrie Gottschalk unified AAFP’s marketing team with Jira

At the American Academy of Family Physicians, siloed marketing teams faced delays and duplicate work. Kerrie Gottschalk shook things up by moving the department to Jira, streamlining processes, boosting visibility, and sparking stronger collaboration.

Read the story
AUG Leaders

Atlassian Community Events