Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How can i download an Excel from Page with Rest API.

Mahesh Pawar January 22, 2018

I have tried successfully  updating an excel attachment in conflunecn page using

""#REST Call in Python

headers = {
    'X-Atlassian-Token': 'nocheck',
    }
    files = {
        'file': (filePath, open(filePath, 'rb')),
    }
    data={"comment":"testing rest"}
    response = requests.post('http://conflunec server:port/rest/api/content/pageID/child/attachment/attachmentID/data', data=data,headers=headers, files=files, auth=('username', password))

""

But can i download the same Excel using REST api calls??

*Confluence version 6.3.3.

2 answers

1 accepted

1 vote
Answer accepted
Mahesh Pawar January 23, 2018

hey Thanks Ann,

I do have found the Solution..goes like this

""

import requests,os;
response = requests.get('http://conflunec_server:port/download/attachments/attachmentID/attchment_Name.xlsx',
    auth=('username', password'))
file=open("NewFile.xlsx","w");
file.write(response.content);
file.close();

"""'

AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 23, 2018

I appreciate your letting us know - it could help the next person who wants to download an attachment using the API.

0 votes
AnnWorley
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 22, 2018

Hi Mahesh,

I understand you can update an Excel attachment using REST but you would like to know how to also download an attachment from Confluence using REST. Please see: confluence pages - get attached files via REST API As there are a couple of strategies described there.

Cheers,

Ann

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events