Downloading issue attachments via JIRA API in Java

I am creating a webpage where the user will be able to view the thumbnails of attachments for an issue, and when clicking on a thumbnail, the browser will load the attachment itself.

I can load all of an issue's details onto the page by using the API (e.g. the webpage shows the key, issue type, description, priority, attachment info, etc.), however the problem is that when I try to create a thumbnail for an attachment, it does not load the image in the browser. When clicking on that thumbnail to load the attachment, it redirects to the official JIRA page for the user to login.

This is the code on my webpage for loading the content, I am getting the content and thumbnail URLs from the JSON data returned from calling "GET /rest/api/2/issue/{issueIdOrKey}":

<a href="{{attachment.content}}">
	<img src="{{attachment.thumbnail}}" height="32" width="32" />
</a>

I understand this can be resolved once logging in via the official JIRA page, however my webpage already has a login page where the user enters their credentials and can then view issue details once successfully logged in, so I don't want users to log in twice. My webpage uses cookie-based authentication for logging in users.

Is there a way to resolve this so the webpage can load attachment thumbnails and content without requiring a second login?

1 answer

This widget could not be displayed.

What are you actually trying to accomplish here? On a higher level? Maybe there is already an add-on in the Atlassian Marketplace. Or maybe you would be better off writing this as an Atlassian Connect add-on: connect.atlassian.com

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

264 views 1 3
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