Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Export TermCollection as XLSX

Request

GET editor/languageresourceinstance/xlsxexport

ParamscollectionId Required. Id of a TermCollection to be exported.

Important: XSLX export is a two-step operation consisting of prepare-step and download-step. 

Prepare-step may take a while depending on TermCollection size, and is implemented in a way that allows to track the preparation progress measured in percents of already exported term entries vs total term entries in that TermCollection, so progress is printed during the export.

Code Block
languagejs
titleResponse
collapsetrue
Total number of term entries: 1
Starting export...
Progress: 0%
..
Progress: 95%
Progress: 100%
Preparing the download...
Done in 2.35 sec

Once export is Done, browser page is reloaded with javascript and the download is started - so yes - all this is intended to work via browser.
For getting the same result via REST API some important things need to be considered:

Example: REST API request via curl-command

Step 1: curl --no-buffer -H "Cookie: zfExtended=your_translate_session_coookie" http://yourTranslate5app.com/editor/languageresourceinstance/xlsxexport?collectionId=XXX

This is the first needed request, that starts and keeps session and shows the progress as pure HTML code during execution (see below)

Code Block
languagejs
titleResponse
collapsetrue
<pre>Total number of term entries: 1</pre><pre>Starting export...</pre><pre>Progress: 100%</pre><pre>Preparing the download...</pre><pre>Done in 0.078 sec</pre><script>window.location=window.location</script>

Step 2: curl -H "Cookie: zfExtended=your_translate_session_coookie"  -o file.xlsx  http://yourTranslate5app.com/editor/languageresourceinstance/xlsxexport?collectionId=XXX

This is the second needed request that preserves the session and responses with 'Content-Disposition: attachment' header and raw file data as response body, which is saved into file.xlsx on your local computer from where you call the curl-command

...