Forums

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

I am not able to download jira attachment using rest service?

Nageswara Rao Koppisetti
Contributor
August 2, 2018

Hi All,

I am consuming Jira rest issue API using java(rest/api/2/issue/10010).This API contains attachment i have to download and place some folder to that attachment using java based on the parsing URL."secure/attachment/10011/AttachmentAnalysis.txt".But i am able to place file but  not getting content .this file contains 302 Found comment.could you please help on this.

rest/api/2/issue/10010.

 

Regards,

Nageswara K.

 

2 answers

0 votes
Ray Xie
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!
May 8, 2019

Need to disable redirection when making the GET call. If you use RestSharp, you can do client.FollowRedirects = false or http.FollowRedirects = false.

And then check that response status code 302 and read the location header. The location header contains the actual link to download the attachment.

0 votes
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 6, 2018

302 is an indication of redirection.  Users have posted similar questions in the past such as

In some cases the problem is with the way you are authenticated.  In others, users have provided specific code you can use in order to download and store that data into a file such as that in https://community.atlassian.com/t5/Jira-questions/How-do-I-upload-attachment-to-JIRA-Issue-via-REST-API/qaq-p/545073   In that thread Loic posted both an upload/download code in order to handle attachments.

 

If this is not helpful in your case, please tell us more about your use case here?  Are you creating a java plugin to download attachments? I have the feeling that this error might be due to the way the Jira site is handling authentication and in turn the request to grab that specific file is prompting your request to login first before you can view that file.

Suggest an answer

Log in or Sign up to answer