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

This widget could not be displayed.

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. :)

This widget could not be displayed.

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+"$@"}

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

85 views 1 0
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