Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

This method translates files using MT Hive

URL

(POST) /api/apps/mthive/translate/files

PARAMETERS

Parameters are included as a JSON object in the request body:

files

Mandatory. A list of the previously uploaded files that you submit for translation.

Each file is listed with its file token and the file format ID to use.

Example:

[
  {
    "token": "3e896bb7812d48e780a119adf39c6dd0",
    "parserId": 1235
  },
  {
    "token": "3e896bb7812d48e780a119adf39c6dd0",
    "parserId": 231
  }
]

See below on how to upload files and obtain the file tokens.

object[], Mandatory
src

The source language code. Make sure to only use source languages according to the MTHive configuration.

string, Mandatory
trgMandatory. The target language code. Make sure to only use target languages according to the MT Hive configuration.string, Mandatory
profileOptionIdx

The option index for the selected Mt Hive configuration (Zero-based index).

MT Hive lets you specify multiple profiles, see "Settings" > "MT Hive". 

int, Mandatory

FILES AND CONFIGURATIONS

The API requires a file token and a format ID. The former references a previously uploaded file. The latter the file filter configuration ID (or format ID) to use for processing.

To upload a file use this API method: media/upload. It returns a token that you would include with the payload (see files above).

The parserId field designates the file filter configuration to use to process the file. You find the available options for each type of file in the configuration under node /options/formats/{file type}/foptions[*]/foption

Example:

Here a single option (2266) is available for Microsoft Word files. Since the configuration lists the supported file extensions, it is relatively easy to automate a lookup mechanism in code.

 Using an ID that does not exist will result in a failure.

RESULTS

The method executes asynchronously. It returns the operation ID which is a number.

Example:


228991

You would then wait a few seconds and request a detailed operation status using https://wordbee.atlassian.net/wiki/spaces/API2/pages/491571. This will return the status. You need to poll the method and wait 2 to 5 seconds in between polls until the status is Finished or Failed. Please read this page for a detailed explanation: Asynchronous operation

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


ERRORS

The api may return errors if:

  • You are not subscribed to MT Hive or MT Hive is not configured
  • The languages or option are not in the configuration. Note that this can also happen in the case of a language detection
  • The text exceeds the maximum length




  • No labels