Translation - Fluid Topics - Latest

Fluid Topics API Reference Guide

Category
Reference Guides
Audience
public
Version
Latest

This web service allows users with the GENERATIVE_AI_USER role to translate text.

This web service relies on the use of a Translation Generative AI profiles. See Create a generative AI profile.

The FluidTopicsTranslationService.translate JavaScript method makes it easier for PORTAL_ADMIN users to use this web service this web service in a Custom component.

  • A generative AI profile is linked to a specific translation provider. The translation style, quality, and accuracy differs greatly between translation engines.
  • Translation providers cannot all translate the same source and target languages. For Intento, see the List of supported languages web service for more information.
Method Endpoint
POST
/api/ai/translate

Request example

The following code block is an example of JSON request body for the translation web service:

{
  "profileId": "translator",
  "content": "May the force be with you.",
  "sourceLanguage": "en",
  "destinationLanguage": "fr",
  "format": "text"
}
Field Type Required? Description
profileId String Yes A Generative AI profile ID of type Translation.
content String 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 response body can be raw text, or HTML, depending on the format field.

Que la force soit avec vous.
<p>Que la force soit avec <b>vous</b>.</p>
Return code Description
200 OK Returns the translated content.
401 UNAUTHORIZED
  • Profile must be of type TRANSLATION. The provided profile if not of the right type.
  • Required Authentication The user does not have the GENERATIVE_AI_USER role.

For a comprehensive list of all possible return codes, see Return codes.