• 517
    • 30
    • 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.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      Atlassian Update – 18 October 2023

      Hi Everyone, 

      In Confluence 8.3 we released a new backup and restore experience. At the same time we also shipped a new REST API endpoint for XML exports that allows for the automation of heavy or large site merges and space migrations, making it easier to manage these tasks. You can find this endpoint documented in our Confluence REST API Documentation.

      Given this, we have closed this ticket now and created seperate suggestions that allow you to vote for additional REST API endpoints for exports in PDF or HTML format. These tickets are linked below and we encourage you to watch or vote for them if they're of interest to you.

      Kind regards,

      Jacqueline Bietz

      Confluence Data Center

      Suggestion

      The deprecated XML-RPC and SOAP APIs used to have an exportSpace functionality, however they are deprecated since Confluence 5.5. The REST API functionality does not include an option for creating space/site exports. Even if the exported XML is not transferred via the REST interface, the action could trigger the backup of any given space or the instance to the export directory, optionally providing a download link for it

      Workaround
      1. The Confluence CLI provides such functionality, but it is a paid third-party add-on. The above functionality would be important to automate migration/backup tasks for administrators.
      2. Although deprecated, you may still use the RPC-API to export the entire Space – see the examples below.

      Export a Space to XML.

      USRNAME=admin
      USRPWD=password
      CONFBASEURL=http://127.0.0.1:8090/confluence
      SPACE_KEY=SPACEKEY
      
      curl -s \
          --user $USRNAME:$USRPWD \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -X POST \
          -d '{ "jsonrpc" : "2.0", "method" : "exportSpace", "params" : ["'${SPACE_KEY}'", "TYPE_XML", "true"], "id": 7 }' \
          ${CONFBASEURL}'/rpc/json-rpc/confluenceservice-v2?os_authType=basic'
      

      Export a Space to HTML.

      USRNAME=admin
      USRPWD=password
      CONFBASEURL=http://127.0.0.1:8090/confluence
      SPACE_KEY=SPACEKEY
      
      curl -s \
          --user $USRNAME:$USRPWD \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -X POST \
          -d '{ "jsonrpc" : "2.0", "method" : "exportSpace", "params" : ["'${SPACE_KEY}'", "TYPE_HTML", "true"], "id": 7 }' \
          ${CONFBASEURL}'/rpc/json-rpc/confluenceservice-v2?os_authType=basic'
      

      Export a Space to PDF.

      USRNAME=admin
      USRPWD=password
      CONFBASEURL=http://127.0.0.1:8090/confluence
      SPACE_KEY=SPACEKEY
      
      curl -s \
          --user $USRNAME:$USRPWD \
          -H "Content-Type: application/json" \
          -H "Accept: application/json" \
          -X POST \
          -d '{ "jsonrpc" : "2.0", "method" : "exportSpace", "params" : ["'${SPACE_KEY}'"], "id": 7 }' \
          ${CONFBASEURL}'/rpc/json-rpc/pdfexport?os_authType=basic'
      

      Space import

      For possible workarounds on importing spaces, please also check this KB article: Confluence Space Import Via Scripting Tools

            [CONFSERVER-40457] Add REST API endpoint for generating space exports

            I would like to mention the business case of this requirement to ensure we are all on the same page.

            We store our policies, standard operation procedures, knowledge bases and other important documentation within Confluence. An incident on Atlassian Cloud products, including Confluence, is one of our incident scenario within our plans and risk registries. Unfortunately, Atlassian does not allow a plan B for disaster scenarios where this risk is obvious. The lack of the feature is sadly puts us in a position where we cannot fully rely on Confluence enforcing us either to use it as a secondary source or leave the product if possible.

            Allowing us to backup our documentation to use offline in case of the incidents is a core functionality, not an afterthought.

             

            I added this comment, even though the ticket is closed, as a reminder for all derivatives of this ticket.

            zafer.balkan added a comment - I would like to mention the business case of this requirement to ensure we are all on the same page. We store our policies, standard operation procedures, knowledge bases and other important documentation within Confluence. An incident on Atlassian Cloud products, including Confluence, is one of our incident scenario within our plans and risk registries. Unfortunately, Atlassian does not allow a plan B for disaster scenarios where this risk is obvious. The lack of the feature is sadly puts us in a position where we cannot fully rely on Confluence enforcing us either to use it as a secondary source or leave the product if possible. Allowing us to backup our documentation to use offline in case of the incidents is a core functionality, not an afterthought.   I added this comment, even though the ticket is closed, as a reminder for all derivatives of this ticket.

            So the new REST endpoints only work for Confluence Server? Not Cloud? We have Cloud and want to be able to generate the export as well.

            James Flores added a comment - So the new REST endpoints only work for Confluence Server? Not Cloud? We have Cloud and want to be able to generate the export as well.

            A fix for this issue is available in Confluence Server and Data Center 8.3.0.
            Upgrade now or check out the Release Notes to see what other issues are resolved.

            James Whitehead added a comment - A fix for this issue is available in Confluence Server and Data Center 8.3.0. Upgrade now or check out the Release Notes to see what other issues are resolved.

            Great thanks for the info Davide.

            I have one question which i thought you would have the answer:
            have you found any content missing when using this export method  and importing it later or it went smooth for you

            Any information you can give or anyone can give would be helpfull for me and my team.
            thanks in advance.

            Bipin Nepal added a comment - Great thanks for the info Davide. I have one question which i thought you would have the answer: have you found any content missing when using this export method  and importing it later or it went smooth for you Any information you can give or anyone can give would be helpfull for me and my team. thanks in advance.

            The id, 7 in the example,  is just a number which should be unique in case you run concurrent exports

            Davide Trombini added a comment - The id, 7 in the example,  is just a number which should be unique in case you run concurrent exports

            can anyone explain what is the 
            "id": 7
            that is used here, i was thinking it was spaceid but it is given as id here, can i just give 7 to every requests or ??????

            Bipin Nepal added a comment - can anyone explain what is the  "id": 7 that is used here, i was thinking it was spaceid but it is given as id here, can i just give 7 to every requests or ??????

            Great, Thanks for the info Adam.

            Reshmi Raveendran added a comment - Great, Thanks for the info Adam.

            Adam Labus added a comment -

            Hi Reshmi,
             
            At the moment the plugin does not support changing export directory.
             
            The downloadPath shown by the plugin (example "/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip") is part of the url where you can download the zip file (CONFLUENCE_URL+downloadPath), it will be a little different in your application (i think without /confluence/)
             
            The exports are made in the same directory as the standard exports - CONFLUENCE_HOME_DIR/temp/ - You can change this location based on https://confluence.atlassian.com/doc/confluence-home-and-other-important-directories-590259707.html#ConfluenceHomeandotherimportantdirectories-homedirectoryConfluencehomedirectory 
             

            The temp directory is used for runtime functions such as exporting, importing, file upload and indexing. Files in this directory are temporary and can be safely removed when Confluence is offline. A daily job within Confluence deletes files that are no longer needed. 
            
            You can specify a different temp directory location, if necessary. Edit <confluence-home>/confluence.cfg.xml and set the new location in the webwork.multipart.saveDir property. Your new location can't be in the installation directory, as this will cause some functions, such as download, to fail. We recommend you keep the temp directory in the local home directory. 

             
            Best regards
            Adam Labus

            Adam Labus added a comment - Hi Reshmi,   At the moment the plugin does not support changing export directory.   The  downloadPath  shown by the plugin (example "/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip") is part of the url where you can download the zip file (CONFLUENCE_URL+ downloadPath) , it will be a little different in your application (i think without /confluence/)   The exports are made in the same directory as the standard exports - CONFLUENCE_HOME_DIR/temp/ - You can change this location based on https://confluence.atlassian.com/doc/confluence-home-and-other-important-directories-590259707.html#ConfluenceHomeandotherimportantdirectories-homedirectoryConfluencehomedirectory     The temp directory is used for runtime functions such as exporting, importing, file upload and indexing. Files in this directory are temporary and can be safely removed when Confluence is offline. A daily job within Confluence deletes files that are no longer needed. You can specify a different temp directory location, if necessary. Edit <confluence-home>/confluence.cfg.xml and set the new location in the webwork.multipart.saveDir property. Your new location can't be in the installation directory, as this will cause some functions, such as download, to fail. We recommend you keep the temp directory in the local home directory.   Best regards Adam Labus

            Hi Adam,

            I did check out the extender plugin and its really helpful!!

            noticed that the downloadPath is "/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip"

            Could you please let me know if it can also provide an option to export space to a particular folder path that i wish to download to.

            Reshmi Raveendran added a comment - Hi Adam, I did check out the extender plugin and its really helpful!! noticed that the downloadPath is "/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip" Could you please let me know if it can also provide an option to export space to a particular folder path that i wish to download to.

            Hello guys,

            if you need solution for now, please check my plugin Extender for Confluence 

            Example: Import/Export Space 

            Cheers
            Adam Labus

            Adam Labus added a comment - Hello guys, if you need solution for now, please check my plugin Extender for Confluence   Example: Import/Export Space   Cheers Adam Labus

              03cb0c04aa4f Irina Tiapchenko
              pkoczan Peter Koczan (Inactive)
              Votes:
              373 Vote for this issue
              Watchers:
              216 Start watching this issue

                Created:
                Updated:
                Resolved: