automating download of document from our confluence

Shuma Dev April 9, 2018

 

 Atlassian Confluence 4.3.2, the Enterprise Wiki

 Hi

I have the task to dowload a document from our wiki, in an automated process.

I have tried several method, they all lead to download of the html page (and upto a max of 39KB).

When I try the same command on other website (for docs or pdf) they work fine (the file of proper format gets downloaded).

I am using powershell. Here is what I have tried.

This works.

wget -O my.pdf  "https://www.tutorialspoint.com/vbscript/vbscript_tutorial.pdf"

But this doesn't work

wget -O my.pdf  --user user --password mypassword "http://tsm-wiki/download/attachments/38897186/Al%27s+comments.doc?version=1&modificationDate=1351755856000"

 

Why does it download only upto 39kb (is there a settting to increase that?) and also not download the actual file (.doc instead of html)

I am not a confluence admin.

 

Thank you.

B

 

 

2 answers

0 votes
Shuma Dev April 11, 2018

I solved it by using something that seems to be the case for other Atlassian products (ie JIRA)

You need to have the login info in the URL itself.

$client = new-object System.Net.WebClient

$client.DownloadFile("http://Companywiki/download/attachments/211190363/St-1.0.docx?os_username=myusername&os_password=mypassword","D:\St-1.0.docx")

 

also remove any other stuff added after the extension of the file name in the URL

ex:  http://mycompanywiki/download/attachments/211190363/St-1.0.docx?version=1&modificationDate=1522908951708?os_username=myusername&os_password=mypassword","D:\St-1.0.docx")

 

to 

http://mycompanywiki/download/attachments/211190363/St-1.0.docx?os_username=myusername&os_password=mypassword","D:\St-1.0.docx")

0 votes
Igor M.
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 9, 2018

Hello,

I found a discussion that appears to address the same problem you described here, please have a look: https://community.atlassian.com/t5/Confluence-questions/wget-to-download-Confluence-attachment/qaq-p/362343

In that discussion, a recommendation was to use 

curl -O -u user:password "http://confluence.mydomain.com/download/attachments/12345678/readme.txt"

 Hope this helps,

Igor

Shuma Dev April 9, 2018

Thanks for that. But after reading the whole thread, there doesn't seem to be a solution to what the person was facing.

I have similar issue

-the file size and type are not correct [max size of 39kb, and html instead of .doc]

-even using credentials does not work

I am also using 

wget --user myname --password mypassword URL 

 

Note that this works on other public sites (where credentials are not required).

I am on windows.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events