how to add an attachment to JIRA issue through rest API

Hi,

I have file as Inputstrteam i need to attach these file to JIRA ISSUE through rest API.I have accesstoken.I use Oauth authentication to call jira API's .

Can u please help me in this case.

 

Thanks in advance

1 answer

Hi @Dario Bonotto

Thanks for your reply.

I have already seen above URL.That URL contains user name and password.But i am having accessToken(i dont have user name password).i have to add an attachment to jira issue through rest API from my java code.

It should work the same way. You just have to pass the access token in the request header as specified in:


https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/

Pass the OAuth access token in the request header, not request body, when making requests: If you pass the OAuth data in the request body, it will return a “400 Bad Request” error for most methods. You must pass the data in the header instead, e.g. “Authorization: Bearer {access_token}“

 

Thanks @Dario Bonotto

In https://docs.atlassian.com/jira/REST/cloud/ Link

they have defined the Add attachment API, In that API they need attachment as  multi part form request.but my side i have attachment as input stream how can i convert input stram to multipart and send them.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 4 hours ago in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

21 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you