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

0 vote

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
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 yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

46 views 0 4
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