This web service allows users with the AI_USER role to translate text.
- This web service relies on the use of a Translation AI profiles. See Create an AI profile.
- It is necessary to provide an
Ft-Calling-Appvalue when using Fluid Topics web services. See Fluid Topics calling app.
- Translation providers cannot all translate the same source and target languages. Use the Get translation profile languages web service to check what languages are available for an AI profile.
- The
FluidTopicsTranslationService.translateJavaScript method makes it easier forPORTAL_ADMINusers to use this web service this web service in a Custom component.
An AI profile is linked to a specific translation provider. The translation style, quality, and accuracy differs greatly between translation engines.
| Method | Endpoint |
|---|---|
POST |
|
Request example
The following code block is an example of JSON request body for this web service:
{
"profileId": "translator",
"content": [
"May the force be with you.",
"I am your father."
],
"sourceLanguage": "en",
"destinationLanguage": "fr",
"format": "text"
}
| Field | Type | Required? | Description |
|---|---|---|---|
profileId |
String | Yes | An AI profile ID of type Translation. |
content |
Array | Yes | The content to translate. The content can be raw text or HTML. |
sourceLanguage |
String | No | The language for the content to translate. If missing, the translation engine tries to identify the language. Not providing a source language can result in inaccurate translations. Users should try to provide one, if possible. The value must be a ISO 639-1 language designator (for example, fr for French, or es for Spanish). Can be followed by a hyphen, and an ISO 3166-1 region designator in uppercase (for example, fr-CA for Canadian French, or es-ES for Castilian Spanish). |
destinationLanguage |
String | Yes | The language to translate into. The value must be a ISO 639-1 language designator (for example, en for English, or es for Spanish). Can be followed by a hyphen, and an ISO 3166-1 region designator in uppercase (for example, en-US for American English, or es-MX for Mexican Spanish). |
format |
String | No | Can be text or html. It is text by default. |
Response body
The following code block is an example of JSON response body for this web service:
{
"items": [
"Que la force soit avec vous.",
"Je suis ton père."
]
}
| Return code | Description |
|---|---|
200 OK |
Returns the translated content. |
401 UNAUTHORIZED |
|
For a comprehensive list of all possible return codes, see Return codes.