Can I use wget to download attachments?

We are using a JIRA web site as a transfer point between two companies and a particular ticket to pass patches back and forth. (I won't go into the politics as to why this is so. Suffice it to say that this vehicle was chosen as the result of a negotiating process.) Anyway, as you might suspect, the list of stuff I need to pull gets long. I got what I thought was a list of URL's to pull, only to discover wget had pulled 30 copies of a java script intended to bring up a "where do you want this" helpful window. Not what I want. How do I just get the files without all the extra UI help? Thank you!

3 answers

1 accepted

Don't know about that, but you may find JIRA Command Line Interface useful. Specifically getAttachment and getAttachmentList

I went to your "JIRA Command Line Interface" link and confess I found it confusing. There are a lot of entries there with no clear ordering or way to decide which one it is I want. I guess this one: jira-cli-3.1.0-distribution.zip -- I'll know in a bit. Thank you!

https://bobswift.atlassian.net/wiki/display/JCLI/Documentation#Documentation-getAttachment ``Get lastest'' I found to be a fun term. :)

It takes a little getting used to, but it works like a charm. Thank you. A tiny nit: "$@" will _always_ expand to at least one parameter. If it is empty, the program sees one empty argument. ${1+"$@"} is a little geeky, but expands to nothing when there are no arguments.

$ cat jira.sh 
#!/bin/bash

# Comments
# - Customize for your installation, for instance you might
# want to add default parameters like the following:
# java -jar `dirname $0`/lib/jira-cli-3.1.0.jar --server
# http://my-server --user automation --password automation "$@"

server='--server http://jira-..../'
passwd='--user automation --password automation'
jar="-jar $(dirname $0)/lib/jira-cli-3.1.0.jar"
java $jar $server $passwd ${1+"$@"}

Yes, you can. You can use bash `wget`, `curl` or whatever tool suits you. But not without any preparation. You have to use WebDav Servlet. So, assuming we are talking about confluence cloud and domain: `example.atlassian.net`, your URL would be: 

https://example.atlassian.net/wiki/plugins/servlet/confluence/default/Global/

This would get you "dashboard" view. If you want to download attachment 'samplefile' on space 'EXAMPLE' under page `subsite`, with tree as follows:

EXAMPLE/
├── home
│   └── subsite
└── test

Your URL would look like: 

https://example.atlassian.net/wiki/plugins/servlet/confluence/default/Global/EXAMPLE/home/subsite/samplefile

Example in bash, using `wget`:

$ wget --user=test.user --ask-pass https://example.atlassian.net/wiki/plugins/servlet/confluence/default/Global/EXAMPLE/home/subsite/samplefile

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,269 views 14 20
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
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