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

Export Pages with Attachments

Ramprasad Baliga March 14, 2022

We want to export all of our pages in confluence space as a separate word file. Since the project is huge, we cannot do the export page by page. Is there an easy way to do this? Also, we want to include the attachments in the export. These exports will later be stored in service now knowledge base. How can we achieve this ?

1 answer

0 votes
Piyush A (STR)
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2022

Hi,

Requirement: Python OR Shell Scripts (curl)

 

Process:

Fetch all the pages id using GET - https://<URL>/wiki/rest/api/space/<space key>/content?start=0&limit=9999&type=page

 

Now using scripts - iterate the page id for the below and save the output with the page name from the above

GET at https://<URL>/wiki/exportword?pageId=<page id>

 

:) - Probably save the list of page id and names in an CSV and iterate that CSV as curl to save the output which would be word file.

 

Notes on Word exporting

  • Only the first 50 images attached to the page are exported to your Word document.

 

PS: You might need to do some checks in the scripting (shell would be easy) an can be run from the system with internet.

Ramprasad Baliga March 15, 2022

Hi Piyush,

Thanks for the response and sharing related links. I see this works if the page has an image. what about other attachments for ex: csv, docx that are attached to a page? Is there an easy way to download all these attachments?

Or do we have to iterate through the API as mentioned in this article and download all the attachments? - somehow we are unable to download attachments using the API mentioned in this article.

Regards

Ram

Conrado Maggi March 18, 2022

To download all attachments, fist you list to list them with

https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-get

For each attachment ID you need to get the download URL with

https://developer.atlassian.com/cloud/confluence/rest/api-group-content---attachments/#api-wiki-rest-api-content-id-child-attachment-attachmentid-download-get

 

Finally, with the URL, you can download the attachment using curl and store it.

Like Piyush A (STR) likes this
Ramprasad Baliga March 28, 2022

We are able to download all the attachments of a page using below API

https://<url>/wiki/download/all_attachments?pageId=<pageid> 
Like Conrado Maggi likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events