How to move Confluence pages along with the contents from one space to another using Python?

Viewed 880

I'm trying to write a Python script based on the atlassian-python-api module which will copy the spaces from one space and the create them in another space hosted in a different server using the following commands:

pages = sourceConfluence.get_all_pages_from_space(space = source_Space, start=0, limit=100, status=None, expand='body.storage.content', content_type='page')
for i in pages:
    status = destConfluence.create_page(space = dest_Space, title=i['title'], body=i['body'], parent_id=None, type='page', representation='storage')

This works fine until pages with content like pdf or images comes in. In that case, it creates a invalid link for the contents in the newly generated pages.

How can I move the pages with the content intact using the wrapper or Confluence REST API directly?

1 Answers

As per my understanding, there’s no proper way to do this programmatically as of now using Python.

The only ways we can achieve this are as follows:

  1. Copy Paste the pages manually one by one from edit mode.
  2. XML Export & Import the space by putting the XML file in the JIRA server.
  3. Using Bobswift CLI tool which supports this functionality.
Related