Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-59841

As a Confluence Administrator I would like to import Spaces via REST API

XMLWordPrintable

    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Problem Definition

      As a Confluence administrator I am able to import a specific space through the admin UI as explained in Restoring a Space.

      Importing multiple spaces can take a long time thought the UI, since you need to perform the same task multiple times.
      It would be interesting to have an API method to automate this task.

      Suggested Solution

      Add a REST API method to import a Confluence Space.

      Workaround

      Although the SOAP-XML API is deprecated, it is still available in Confluence while not all methods are ported to REST.

      The Confluence administrator may use the importSpace method to import a Confluence Space.

      Below is an example of such an operation using Python:

      #!/usr/bin/python
      
      from __future__ import with_statement
      import sys, string, suds, re, os, base64
      
      from suds.client import Client
      url = 'http://localhost:6733/c733/rpc/soap-axis/confluenceservice-v2?wsdl'
      client = Client(url)
      
      with open('Confluence-space-export-110203-4.xml.zip', 'rb') as myfile:
              data = myfile.read()
              encodedFile = base64.b64encode(data)
      
      token = client.service.login('admin', 'admin');
      
      outputpath = client.service.importSpace(token, encodedFile);
      
      print outputpath;
      

              Unassigned Unassigned
              tmasutti Thiago Masutti
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: