Page tree

Versions Compared

Key

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

...

Code Block
languagebash
titleCurl Example
curl 'https://www.translate5.net/editor/task' -X POST  \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN' \
  -F "format=jsontext" \
  -F "taskName=This is a import test" \
  -F "sourceLang=de" \
  -F "targetLang=it" \
  -F "edit100PercentMatch=1" \
  -F "lockLocked=1" \
  -F "autoStartImport=0" \
  -F "importUpload=@/PATH/TO/YOUR/FILE.xlf"

...

Code Block
curl 'http://translate5.localdev/editor/languageresourcetaskassoc?_dc=1621243689215&filter=%5B%7B%22property%22%3A%22taskGuid%22%2C%22operator%22%3A%22eq%22%2C%22value%22%3A%22%7B_THE_TASK GUID_%7D%22%7D%5D' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN'

Associate found language resources to the task

...

Code Block
titleas CURL example
  curl 'http://translate5.localdev/editor/languageresourcetaskassoc' \
  -X POST \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN'
  --data-raw 'data=%7B%22languageResourceId%22%3A%222614%22%2C%22taskGuid%22%3A%22%7B928ac493-618e-4475-9436-521c2e3432e7%7D%22%2C%22segmentsUpdateable%22%3Afalse%7D'

...

Code Block
curl 'http://translate5.localdev/editor/task/9015/pretranslation/operation' \
  -X 'PUT' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN'
  --data-raw 'internalFuzzy=0&pretranslateMatchrate=100&pretranslateTmAndTerm=1&pretranslateMt=1&termtaggerSegment=0&isTaskImport=1&batchQuery=0'

...

Code Block
curl 'http://translate5.localdev/editor/config?_dc=1621243733095&taskGuid=%7B928ac493-618e-4475-9436-521c2e3432e7%7D' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN'

Specific configurations for a specific task import can be set like this:

Code Block
curl 'http://translate5.localdev/editor/config/runtimeOptions.import.csv.fields.source' \
  -X 'PUT' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THENTOKEN'
  --data-raw 'taskGuid=%7B32309a4f-6a22-488a-ac50-b8b520896bdb%7D&data=%7B%22value%22%3A%22source123%22%2C%22taskGuid%22%3A%22%7B32309a4f-6a22-488a-ac50-b8b520896bdb%7D%22%2C%22name%22%3A%22runtimeOptions.import.csv.fields.source%22%7D'

...

Code Block
curl 'http://translate5.localdev/editor/task/NUMERIC_TASK_ID/import' \
  -H 'Connection: keep-alive' \
  -H 'Accept: application/json' \
  -H 'CookieTranslate5AuthToken: zfExtended=HERE_WILL_BE_YOUR_SESSIONAPP_ID_THEN'TOKEN'

Task import callback

Since a import is running in the background, the so created task will be returned with a state = import. For checking if the import is done, a callback should be configured: task import push callback