How to download On demand Confluence page content image to local machine?

Hi,

I am new user for on demand confluence, i am able to read the page content using REST API

- https://{companyName}.atlassian.net/wiki/rest/prototype/1/content/524312?expand=attachments

I
am find the image src link in this content like below

- https://{companyName}.atlassian.net/wiki/download/attachments/524312/worddave1f7873c424d7824e580764369e7ee68.png

I
am trying to download the images in the page content to local directory using the below c# coding

image=https://{companyName}.atlassian.net/wiki/download/attachments/524312/worddave1f7873c424d7824e580764369e7ee68.png;
imageLocation =@"C:\Images";
string[] FileName = image.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
WebClient client = new WebClient();
client.Credentials = new NetworkCredential("xxx", "yyy");
client.DownloadFile(new Uri(image), imageLocation + "\\" + FileName[FileName.Count() - 1]);

I am not able to download the any images from on demand confluence page.

I also tried the below things
1. I have manually export the particular page by "Export to HTML" from page operations in on demand confluence
2. I have checked that export HTML zip file, an attachment directroy have the images in the particular page

I need to achieve my goal like above, please share your knowledge

1 answer

1 accepted

I have changed my code like below, than i have downloaded the on demand confluence page content images to my local machine

image=https://{companyName}.atlassian.net/wiki/download/attachments/524312/worddave1f7873c424d7824e580764369e7ee68.png;
imageLocation =@"C:\Images";
string[] FileName = image.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
WebClient client = new WebClient();
client.DownloadFile(new Uri(image+"?&os_username=xxx&os_password=yyy"), imageLocation + "\\" + FileName[FileName.Count() - 1]);

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

2,909 views 27 12
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