Jira REST API view/download attachments

Hello, I'm wirting a C# app that talks with Jira using REST API 6. I manage to do everything I want, but when I try to display images (using their URL) attached to Issues I cannot do that, because the "user" (my app) is not logged in.

So, is there a way to get the attachments as binary data, or a way to bypass autenthication for attachments? Or to get the real full URL from the server?

4 answers

1 accepted

1 vote
Accepted answer

Ok, I figured out it by myself!

Stupid mistake: I just didn't understand that I needed to request the file with another GET request and then decode the stream to file!!

using (var sw = new StreamWriter(@"path-to-where-i-want-to-save-the-file"))
                        {
                            sw.Write(Encoding.UTF8.GetString(response.RawBytes.ToArray()));
                        }


hi, can you provide sample for this? thanks

Hey, have a look to this ValueConverter I wrote:

http://pastebin.com/be9EqacN#

thanks this is a big help. What we want is download all attach files in the issue.

What is the get you are using to retrieve the binary data?  I cannot find a REST call to get that information

0 votes
Timothy Chin Community Champion Oct 22, 2013

because the "user" (my app) is not logged in

Then you need to log yourself in. There's oAuth and basic auth.

or a way to bypass autenthication for attachments?

Create a user that has permission to all issues? And I don't think there's a way to just bypass that.

Have you tried streaming the attachment using the content attribute?

Hey maybe I was not clear, I do autenthicate, that's how I get the attachment url: https://developer.atlassian.com/static/rest/jira/6.0.1.html#id150787

But then, as I use the attachment url, let's say of a picture, inside a picture box it won't show because it's like an anonymous user trying to see the file, for the server since the url is jira/secure/....

What do you mean by streaming?

Hi, Can yo provide a sample on how to download the attach files? thanks

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Jira Service Desk

Looking for anyone who has switched from Zendesk to Jira Service Desk

Hi Community! The Jira Service Desk marketing team is looking for customers who have successfully switched from Zendesk to Jira Service Desk!   We’d love to hear your thoughts on the pros and ...

27 views 0 1
Join discussion

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