Problem Scenario
Calling for translations through the API by using a specific translator 'profileID' would require code changes each time a new translator version is released/updated.
Example: 2 translators are deployed in SPNS for Spanish -> English:
- Spanish (ES) to English (EN) Generic - 9.2.3
- Spanish (ES) to English (EN) - IT - 9.2.1
Is there a way to specify a 'default' Profile when calling for Translations through the API so as to avoid using specific profile IDs? For example, is it possible to ensure that all API calls are pointing to the Spanish IT Model rather than the Generic model?
Answer
A translator (TR) can be selected by its specific 'profileID'/UUID, but the recommended method is to choose a translator using “selectors”. The available selectors are “owner”, “domain” and “size”. The “owner” is the profile creator and the “domain” is the main topic covered by the translator, such as “IT”, “Medical” or a general-purpose domain such called “Generic”.
When the SPNS translation API services are provided with selectors, it will choose the closest matching translator based on the selector values. The default size is “M” if none is specified and the default domain is “Generic”.
The available translators and associated selectors can be retrieved using the SPNS profile API service (/translation/profiles).
An example from a (non-SSL) server using IT domain (&domain=IT):
curl -X POST "http://translation-server-URL_IP:8903/translation/text/translate?key=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx&source=en&target=it&domain=IT&input=hello"