Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
Info

Available since v. 2.XX15.0

  • Added space export/import REST APIs


Export space

Available only for Confluence Administrator

Method type: 

Status
colourYellow
titlepoST

URL: {CONFLUENCE_URL}/rest/extender/1.0/export/space/{SPACE_KEY}

  • where {SPACE_KEY} is the space key

Request format: JSON

Example request:

Code Block
languageactionscript3
{
    "exportType": "XML",
    "exportComments": true,
    "exportAttachments": true
}
Code Block
languageactionscript3
{
    "exportType": "HTML"
}
  • exportType - required - export type - XML or HTML

  • exportComments - optional - export comments flag - true or false (default)

  • exportAttachments - optional - export comments flag - true or false (default)

Response format: JSON

Example response:

Code Block
languageactionscript3
{
    "message": "writing export",
    "taskId": "95d6a1d3-0bd2-401b-8288-057e022c6475",
    "status": "in progress"
}

Code Block
languageactionscript3
{
    "message": "another export is in progress",
    "taskId": "4f3a1aec-5493-4049-8e54-54563c19a971",
    "status": "waiting"
}


Check export task status

Available only for Confluence Administrator

Method type: 

Status
colourGreen
titleGET

URL: {CONFLUENCE_URL}/rest/extender/1.0/export/task/{TASK_ID}

  • where {TASK_ID} is the task id from export api (example: 4f3a1aec-5493-4049-8e54-54563c19a971)

Response format: JSON

Example response:

Code Block
languagejson
{
    "isSuccessful": true,
    "currentStatus": "Starting... ",
    "percentageComplete": 0,
    "name": "Export Space",
    "prettyTimeRemaining": "Unknown",
    "isComplete": false,
    "prettyElapsedTime": "12 seconds"
}
Code Block
languageactionscript3
{
    "isSuccessful": true,
    "currentStatus": "Writing export",
    "percentageComplete": 36,
    "name": "Export Space",
    "prettyTimeRemaining": "20 seconds",
    "isComplete": false,
    "prettyElapsedTime": "11 seconds"
}
Code Block
languagejson
{
    "fileName": "Confluence-space-export-105420-1762.html.zip",
    "isSuccessful": true,
    "downloadPath": "/confluence/download/temp/htmlexport-20210410-105400-1761/Confluence-space-export-105420-1762.html.zip",
    "currentStatus": "Export complete. Download <a class=\"space-export-download-path\" href=\"/confluence/download/temp/htmlexport-20210410-105400-1761/Confluence-space-export-105420-1762.html.zip\">here</a>.",
    "percentageComplete": 100,
    "name": "Export Space",
    "prettyTimeRemaining": "Unknown",
    "isComplete": true,
    "prettyElapsedTime": "25 seconds"
}
Code Block
languagejson
{
    "fileName": "Confluence-space-export-113149-3510.html.zip",
    "isSuccessful": true,
    "downloadPath": "/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip",
    "currentStatus": "Export complete. Download <a class=\"space-export-download-path\" href=\"/confluence/download/temp/htmlexport-20210410-113127-3509/Confluence-space-export-113149-3510.html.zip\">here</a>.",
    "percentageComplete": 100,
    "name": "Export Space",
    "prettyTimeRemaining": "Unknown",
    "isComplete": true,
    "prettyElapsedTime": "30 seconds"
}


Import space

Available only for Confluence Administrator

Method type: 

Status
colourYellow
titlepoST

URL: {CONFLUENCE_URL}/rest/extender/1.0/export/import/file

Request format: JSON

Example request:

Code Block
languageactionscript3
{
    "fileName": "Confluence-space-export-113149-3510.zip",
    "reindex": true
}
Code Block
languageactionscript3
{
    "fileName": "Example_file.zip"
}
  • fileName - required - space export file name from <confluence-home>/restore directory

  • reindex - optional - reindex flag - true or false (default) - this will perform a full reindex of your site immediately after the space or site file is imported

Response format: JSON

Example response:

Code Block
languageactionscript3
{
    "message": "importing file",
    "taskId": "2d7c282e-a256-46cf-9d88-a0af0d15a735",
    "status": "in progress"
}
Code Block
{
    "message": "another import is in progress",
    "taskId": "49d53b5f-a87b-4e6c-bd81-d51203aba04c",
    "status": "waiting"
}
Code Block
languageactionscript3
{
    "message": "unexpected import zip file contents: Confluence-space-export-113149-3510.html.zip",
    "status": "canceled"
}


Check import task status

Available only for Confluence Administrator

Method type: 

Status
colourGreen
titleGET

URL: {CONFLUENCE_URL}/rest/extender/1.0/export/import/{TASK_ID}

  • where {TASK_ID} is the task id from import api (example: e142839b-babf-4326-8d34-c7e2ba275c3f)

Response format: JSON

Example response:

Code Block
languagejson
{
    "isSuccessful": true,
    "currentStatus": "Complete.",
    "percentageComplete": 100,
    "name": "Importing data",
    "prettyTimeRemaining": "Unknown",
    "isComplete": true,
    "prettyElapsedTime": "1 minute, 32 seconds"
}
Code Block
languagejson
{
    "isSuccessful": false,
    "currentStatus": "Import failed. Check your server logs for more information. com.atlassian.confluence.importexport.ImportExportException: Unable to complete import because the data does not match the constraints in the Confluence schema. Cause: JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: \"PUBLIC.UK_JP1AD5YUFSIH5R7LQRYGAKPUG_INDEX_9 ON PUBLIC.SPACES(SPACEKEY) VALUES 1540099\"; SQL statement:\ninsert into SPACES (SPACENAME, SPACEKEY, LOWERSPACEKEY, SPACEDESCID, HOMEPAGE, CREATOR, CREATIONDATE, LASTMODIFIER, LASTMODDATE, SPACETYPE, SPACESTATUS, SPACEID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-200]",
    "percentageComplete": 0,
    "name": "Importing data",
    "prettyTimeRemaining": "Unknown",
    "isComplete": false,
    "prettyElapsedTime": "7 seconds"
}