It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Add an attachment to JIRA from Confluence using REST API

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

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

Community Events

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

Events near you