It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to download a file attached in confluence page

I'm a little bit confused with the REST API documentation.

 

Say I have a confluence page 

https://COMPANY_DOMAIN/confluence/display/SOME_ID/This+is+root+page.

In the above page there is a section with a hyperlink like the below

https://COMPANY_DOMAIN/confluence/download/attachments/51527290/FileName

Reading a little bit around I found an answer implying that with this https://COMPANY_DOMAIN/rest/api/content/{id}/child/attachment I could download the file but not sure what the actual id is.

 

I tried with a GET and adding Authorization header with my company credentials.

Any ideas or examples?

1 answer

0 votes
Thomas Deiler Community Leader Feb 01, 2018

Dear @Georgios Taskos,

nearly everything you need is written in the upper article.

First you need a list of all attachments (can also be only one) of one page.This is done via Rest:

GET /rest/content/{id}/child/attachment

The {id} is the internal number of your page. You can see this when you click on Page Information.

In the JSON response you have to look for the attachment and remember its

_links -> download

value. Then you need to make a normal HTTP call to download the file.

http://localhost:8090/download/attachments/98334/my_attachment.pdf?version=1&modificationDate=1451988725383&api=v2

There the authentication works different as for a rest call, when not running from the browser. Read this post. Its for Jira, but it works the same way for Confluence.

So long

Thomas

Thomas Deiler Community Leader Feb 05, 2018

Dear @Georgios Taskos,

you didn't come back to this question. Have you solved your problem? Do you need still assistance?

So long

Thomas

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published yesterday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

69 views 0 9
Read article

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