Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

download attachment by rest api

Dmitriy.Bochkanov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 21, 2019

Hi, please help download attachment.

I try using the api:

 

Steps:

1. I get list of attachments by

https:/<my_server>/wiki/rest/api/content/{contentId}/child/attachment

2. get {"_links": {"download"://download/attachments/{attach_id}/test_file.pdf?version=1&modificationDate=1569048258206&cacheVersion=1&api=v2}}

3. call 
https://<mu_server>/download/attachments/{contentId}/test_file.pdf?version=1&modificationDate=1569048258206&cacheVersion=1&api=v2&os_authType=basic
with header Authorization Basic <my_token>

as result I get 404

Please tell me where I mistaken?

Thanks.

 

Best Regards, Dmitry.

 

 

1 answer

1 accepted

0 votes
Answer accepted
DPKJ
Community Champion
September 21, 2019

@Dmitriy.Bochkanovare you using /wiki in download url?

i.e.

 

https://<my_server>/wiki/download/attachments/{contentId}/test_file.pdf?version=1&modificationDate=1569048258206&cacheVersion=1&api=v2&os_authType=basic
with header Authorization Basic <my_token>
Dmitriy.Bochkanov
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 21, 2019

@DPKJ 
Thank a lot. You solve it.
But is it error in "download" link?

 

Best regards, Dmitriy

DPKJ
Community Champion
September 21, 2019

@Dmitriy.BochkanovActually on Confluence Cloud, the base url contains context path of /wiki so it is not exactly an error, but Atlassian have not mentioned it clearly anywhere.

If this response helped you, you can accept and like the answer so that we can help other.

Like # people like this
ganeshkumar patil
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 19, 2020

Hi,i Have same problem. I am able to downoad with http link as below:

https://<my server>/confluence/download/attachments/774646522/Forecast.xlsm?version=1&modificationDate=1605691521000&api=v2

 

This link is working on browser. But when i request through python request module, it is not downloading file, even it returns status as 200.

Nagesh Rao
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 11, 2021

Hi @ganeshkumar patil  Did you figure out how to download the attachment using python ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events