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 votes

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 Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

461 views 1 15
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot