Skip to main content

projects/{did}/documents/offline/export (POST)

Export documents from a project to a bilingual format for the purpose of translation in CAT tools other than Wordbee. Export formats are XLIFF, Microsoft Word and Microsoft Excel.

The result is a ZIP archive that contains:

  • An XLIFF, Word or Excel file per each selected/ticked project document.

  • An optional TMX file with the top memory hits.

  • An optional Excel file with word count details.

You may want to “initialise” an export first, see projects/{did}/documents/offline/export/init (GET) . This provides useful information and default options for the importing.

URL

CODE
(POST) /api/projects/{pid}/documents/offline/export

PARAMETERS

The URL parameters are:

pid

The project ID

int, Mandatory

The body must contain a JSON object with these properties:

documents

An array of the project documents to export. See table further down.

To enumerate documents for a project, you have different options:

Example for getting the first 100 documents in project 229:

CODE
(POST) .../api/resources/files/list
BODY:
{ "skip": 0, "take": 100, "scope": { "type": "Project", "projectid": 229 }}

Obviously you can apply filters on file names, extensions, languages and so forth.

object[], Mandatory

format

The output format. Must be one of these strings:

  • Xliff : XLIFF format

  • Word : Microsoft Word format. The document contains a table with the source texts and the translations.

  • Excel : Microsoft Excel format. The document contains both source texts and translations.

string, Mandatory

includeComments

Boolean, default is false.

If true then the document will include existing comments that are attached to the translation.

bool?, Optional

includeMemoryHits

Boolean, default is false.

If true, then the top memory hits are included with each segment in the document.

bool?, Optional

createTmxFile

Boolean, default is false.

If true, then a TMX file (“TM.tmx“) is created and included in the exported ZIP archive. It contains the top memory hits of all the exported files.

This option can be set independently of includeMemoryHits

bool?, Optional

includeCustomFields

Boolean, default is false.

If true, then the exported file includes all custom fields of the segment. Supported by XLIFF export format only.

bool?, Optional

createExcelReport

Boolean, default is true.

If true, then the exported ZIP archive includes an Excel (“Summary.xlsx“) that lists all exported documents with various details such as the word count, the file name, the online editor URL and other useful information.

bool?, Optional

callbackurl, callback

Specify a URL which will be called upon success or failure of operation. This makes polling for operation status unnecessary.

See Callbacks (with asynchronous operations)

Optional

The documents collection is an array of objects with these properties:

did

The document ID. This must be a document in the project.

int, Mandatory

src

The source locale. It is required to specify the source locale. In most cases this will simply be the project source locale but you can even choose a target locale or versioned locale in the context of back translation workflows.

string, Mandatory

trg

The target locale.

string, Mandatory

Note: By default you cannot export more than 50 documents at a time. Please use projects/{did}/documents/offline/export/init (GET) to get the applicable limit.

RESULTS

The API method returns an Asynchronous operation result:

JS
{
  "trm": {
    "requestid":32230,
    "status":"Waiting",
    "statusText":"Waiting..."
  }
}


You can poll the status or use the callback parameter. When the operation is complete, the results are in the custom property

JSON
{
    "trm": {
        "requestid": 32230,
        "isbatch": false,
        "status": "Finished",
        "statusText": "Finished!"
    },
    "custom": {
       [ ****** RESULTS ****** ]
    }
}


The custom property is a JSON object:

filetoken

The file token to download a ZIP archive with the exported XLIFF, Word or Excel files, the optional summary Excel and the optional TMX.

The exported files are grouped in folders by their source/target languages.

Usemedia/get/{token} to download the ZIP file.

Example archive:

The en.de folder contains all exported files for this language combination:

The archive entries are the original file names plus the language combination appended at the end.

The Summary.xlsx file (if option is enabled), lists the exported documents:

string

filename

The name of the ZIP archive. For information only.

string

documents

A JSON listing all the exported documents. The format is the same as that of property documents (see parameters section in this document) but includes archive, which is the relative path inside the ZIP. The latter comes in handy if you need to automate the extraction of files from the archive.

Example:

CODE
{
  "filetoken": "ec91c24b46ed46debbf2595d8db9f33d",
  "filename": "Documents 2023-01-04.zip",
  "documents": [
    {
      "did": 15016,
      "name": "welcome.html",
      "src": "zh",
      "trg": "en",
      "archive": "zh.en\\welcome.html (zh.en).xliff"
    },
    {
      "did": 15022,
      "name": "welcome.html",
      "src": "zh",
      "trg": "fr",
      "archive": "zh.fr\\login.html (zh.fr).xliff"
    }
  ]
}

object

JavaScript errors detected

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

If this problem persists, please contact our support.