Download Attachment from JIRa using java

Gaurav Jain July 12, 2019

Hi Team,

 

I am working on one POC where we need to download all attachment. When I am using POSTMAN i can see the data in beowser. But I am unable to download in my machine. Please let me know How to download the attachment from JIRA

1 answer

1 accepted

2 votes
Answer accepted
Ramarao Gaggara {Appfire}
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.
July 14, 2019

Hi @Gaurav Jain ~ 

You can use the attachment's URL to get the content.

Please try below Rest API :

Thanks,

RamaRao

Gaurav Jain July 15, 2019

Hi

It didnt worked. Do u have any sample code to download the attachment

Ramarao Gaggara {Appfire}
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.
July 15, 2019

Hi @Gaurav Jain ~ Suppose if you are ready with the link for your attachment i.e. something like https://domain.com/jira/secure/attachment/1007353/file.zip

then you can use either one of below commands to download the attachment.

curl -L -O -k -u 'user:pass' -X GET https://domain.com/jira/secure/attachment/1007353/file.zip 
wget --user=user --password=pass https://domain.com/jira/secure/attachment/1007353/file.zip

 

Also please refer the below Jira REST API documentation from Atlassian for further details.

https://docs.atlassian.com/DAC/rest/jira/6.0.1.html#id150787

Thanks,

RamaRao 

Like Filipi Lima likes this
Gaurav Jain July 15, 2019

it worked thanks

Ramarao Gaggara {Appfire}
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.
July 15, 2019

You are welcome @Gaurav Jain !

If you feel like my answer helped you, kindly mark my answer as accepted.

 

Thanks,

RamaRao

ritesh_shah August 8, 2020

It doesn't work for me if there is a comma(,) in file name. Also it is not working for the video files like mp4.

Can you provide solution for that ?

 

Regards.

Like Serhiy Onyshchenko likes this

Suggest an answer

Log in or Sign up to answer