Skip to main content
Skip table of contents

Export and Import Translation ZIP via REST API

You can use the REST API to automatically export and import the Translation ZIP.

Create the translation ZIP file

If Scroll Versions is activated in the space you are exporting, you first have to get the version ID of the version you want to export.

You can do this by sending a GET request to:
<confluence-base-url>/rest/scroll-versions/1.0/versions/<spaceKey>

The response will look like this:

CODE
[
    {
        "id": "<versionId>",
        "name": "<versionName>",
        ...
    },
    ...
]

Then send a POST request with Content-Type: application/json to:
<confluence-base-url>/rest/scroll-versions/1.0/translation/start

The body should consist of data with following parameters:

KeyValue
languageKeyThe key of the language to export (e.g. 'en' for english).
outdatedOnly'true' if only pages with status 'outdated' should be exported, else 'false'.
provider
  • 'simple' for simple translation provider
  • 'xliff' for XLIFF translation provider
spaceKeyThe spacekey of the space you want to export.

variantId (optional - only if Variant Management is activated)

The ID of the variant you want to export, 'all' for every variant.
versionId (optional - only if Version Management is activated)The ID of the version you want to export.
oneFilePerPage (optional)false (default) or true. When using 'xliff' for provider, this parameter has to be defined in the body and set to true value
includeLabels (optional)

A list of label names (as strings). Only pages with any of the provided labels are exported.

E.g. ["label1", "label2"]

excludeLabels (optional)

A list of label names (as strings). All pages with any of the provided labels are excluded from the export.

E.g. ["label1", "label2"]

excludeFallbacks (optional)'true' if versioned pages without changes in the exported version should not be exported.
excludeUnversioned (optional)'true' if unversioned pages should not be exported.
onlyUnversioned (optional)'true' if only unversioned pages should be exported.

The respond looks like this:

CODE
{
    "id": "<taskId>",
    ...
}

To check the created file send the following get request:
<confluence-base-url>/rest/scroll-versions/1.0/async-tasks/<taskId>?since=<dateTime>

If the file was successfully created, the response will look like this:

CODE
{
    "id": "<taskId>",
    ...
    "result": {
        "id": "<fileId>",
        "descriptor": {
        	...
        },
        "fileName": "<fileName>"
    }
}

Download the translation ZIP File

Download the created translation ZIP file from:
<confluence-base-url>/rest/scroll-versions/1.0/translation/adapter/simple/download/<fileId>/<translationProvider>/<fileName>

(info) Both <fileId> and <fileName> can be found in the response to our previous request which checks the translation zip file.

Upload the translation ZIP File

  1. Send a post request to:
    <confluence-base-url>/rest/scroll-versions/1.0/translation/adapter/simple/upload?spaceKey=<spaceKey>&translationProvider=simple

    (info) <spaceKey> is the key of the space you want to import the file to.
  2. Add the file to the request as multipart-form-data from a file-input (see HttpClient Documentation).
    When the Translation ZIP file was uploaded successfully, the response will look like this:

    CODE
    {
        "success": true,
        "result": {
            "id": "<fileId>",
            "descriptor": {
            	...
            }
        },
        ...
    }

    (info) The <fileId> is needed to import the file.

Import the Translations ZIP File

  1. Send a post request to:
    <confluence-base-url>/rest/scroll-versions/1.0/translation/import?spaceKey=<spaceKey>&id=<fileId>&translationProvider=simple

    (info) <spaceKey> and <fileId> are the parameters from step 3.
  2. The response looks like this:

    CODE
    {
        "id": "<taskId>",
        "clusterNo": -1,
        "started": false,
        "cancelled": false,
        "hasFailed": false,
        "finished": false,
        "failureMessage": null,
        "progress": 0,
        "message": "The task 'Translation.Import' is currently queued.",
        "resourceLocation": null
    }

     (info) Note that the individual fields may be different, depending on your timing on your server's workload.

  3. To get the current status of the import, send a Get-Request to:
    <confluence-base-url>/rest/scroll-versions/1.0/async-tasks/<taskId>?since=<dateTime>
    (info) <dateTime>
    is the current time (as int).


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.