Export attachments from JIRA URL or folder? Access to Jira Attachments folder

KP11
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 4, 2013

We need to export or download attachments from a JIRA record for our automation product.

Is there a way to export directly form the JIRA server or a URL option?

We use Jenkins Automation build and want to be able to export our PDF's from JIRA.

Do we have to use command line plugin or is there an easier way to do it from a DOS prompt or Jenkins?

I saw the option to get the attachments from the JIRA_HOME but we need the same file name and do not want scripting work

4 answers

1 accepted

0 votes
Answer accepted
Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

Well, if you know the attachment ID, you can get its download URL using the

/rest/api/2/attachment/{id}

call from the JIRA REST API.

See here for more details: https://docs.atlassian.com/jira/REST/latest/#d2e168

KP11
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2013

Thanks. We will have to find a way for the Jenkins build server to read the html copy link address and use REST API. Have you been able to to automate retrieving the attachment ID from the Jira issue page?

0 votes
Radu Dumitriu
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 9, 2013

Or simply use JJUPIN:

getAttachmentPath(key, attname) - http://confluence.kepler-rominfo.com/display/SIL/getAttachmentPath

&

system() - http://confluence.kepler-rominfo.com/display/SIL/system

attachments variable is predefined on the issue.

You will spare a lot of time :)

0 votes
Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2013

Check the HTML code of the page. It is there. Even better, the download URL is there, as far as I see.

<li class="attachment-content" draggable="true" data-downloadurl="image/png:padding.png:https://jira.atlassian.com/secure/attachment/66083/padding.png">

KP11
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 8, 2013

Yes we saw it. We were wondering if anyone had code/script to pick off the link via an automation product

0 votes
Midori
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2013

Use the JIRA PDF View Plugin!

It:

  • will readily generate you PDF files that already embed the attachments (configurable, customizable). See the Adobe Reader screenshot below.
  • can be used for automation very easily. The PDF's can be generated by sending a request to a certain URL and downloading the result. You can easily wire that to Jenkins (I reckon).

More about embedding JIRA issue attachments to PDF documents »


KP11
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2013

Is there a way to only get the attachment without having the PDF and imbedded attachment? We would like a simple URL or COPY

Suggest an answer

Log in or Sign up to answer