API Reference

You can use Lingvanex API in your products like mobile apps, websites etc

Warning: due to the current status of the API it is provided for non-production testing purposes only.

Lingvanex works via HTTPS requests. The URL of all requests starts with https://backenster.com/b1/api/v3/

In case of a protocol selection error and using HTTP, the request will be redirected to the address with the HTTPS protocol (status code 302).

Authentication of requests is done by adding the “Authorization” header with the following data format: Bearer The key can be created on the user control panel page https://lingvanex.com/account

Getting the list of languages

Description of obtaining the list of languages by means of an HTTP request:
  • Relative address /getLanguages
  • Method GET
  • The maximum time is 30 seconds.
  • Response type “application/json

Parameters of request:

  • platform – ‘api’
  • code – the language code in the format “language code_code of the country”, which is used to display the names of the languages. The language code is represented only in lowercase letters, the country code only in uppercase letters (example en_GBes_ESru_RU etc). If this option is not present, then English is used by default.

Parameter of the body of the response to the query:

  • err – the text of the error. It is null if the response status is 200. Otherwise, it contains a string.
  • result – an array of objects, each of which is a description of the language.

Description of the language object:

  • full_code – the language code in the format “language code_code of the country”.
  • code_alpha_1 – the language code in the “language code” format.
  • englishName – English name of the language.
  • codeName – the language name translated using the language specified by the query parameter “code”.
  • flagPath – the relative address of which is the image of the country flag. Example static/flags/afrikaansThe full address for downloading the flag will be https://backenster.com/v2/static/flags/afrikaans.pngIn order to download flags in increased resolutions, you should add to this parameter: @2x or @3x (example https://backenster.com/v2/static/flags/afrikaans@2x.png or  https://backenster.com/v2/static/flags/afrikaans@3x.png).
  • testWordForSyntezis – a word for testing a speech synthesizer.
  • modes – an array of objects, each of which is a description of the function that is supported in the given language.

Description of the function object:

  • name – name of the function. Currently, only 4 functions are widely supported: Speech synthesis“, “Image recognition“, “Translation“, “Speech recognition“.
  • value – logical value true or falsewhich shows the status of the function: on or off.
  • genders – logical value true or falsewhich shows the ability to synthesize speech for both sexes. Displayed only for function “Speech synthesis“.

Text Translation

Description of text translation via HTTP request:
  • Relative address /translate
  • Method POST
  • Maximum lifetime 30 seconds.
  • Content type is support in both values: “application/x-www-form-urlencoded” and “application/json

Request parameters:

  • from – the language code in the format “language code_code of the country” from which the text is translated. The language code is represented only in lowercase letters, the country code only in uppercase letters (example en_GBes_ESru_RU и т.п.). If this parameter is not present, the auto-detect language mode is enabled.
  • to – language code in the format “language code_code of the country” to which the text is translated (required).
  • data – data for translation (required). Two types of data are supported: a string and an array of strings.
  • platform ‘api’.

Response parameters:

  • err – the text of the error. It is null if the response status is 200. Otherwise, it contains a string.
  • result – result of translation. In the event that a line was sent to the translation, the result is also a string; if an array of strings, then we also get an array of strings.
  • cacheUse – the number of letters translated using the Lingvanex service cache (whether it is required?).
  • source – source data for translation (whether it is required?).
  • from – code of the source language in the format “language code”. In the case of sending a translation of an array of strings with different language content, only the language of the first element of the array is returned.
  • sourceTransliteration – transliteration of source data. In the event that a line was sent to the translation, the result is also a string; if an array of strings, then we also get an array of strings.
  • targetTransliteration – transliteration results. In the event that a line was sent to the translation, the result is also a string; if an array of strings, then we also get an array of strings.

 

cURL example:

curl 'https://backenster.com/b1/api/v3/translate/' \
-H 'authorization: Bearer YOUR_API_KEY' \
-H 'content-type: application/x-www-form-urlencoded; charset=UTF-8' \
--data 'from=en_GB&to=de_DE&text=London+is+the+capital+and+largest+city+of+England+and+of+the+United+Kingdom.&platform=api'

Result:

{
  "err": null,
  "result": "London ist die Hauptstadt und größte Stadt Englands und des Vereinigten Königreichs.",
  "cacheUse": 0,
  "source": "London is the capital and largest city of England and of the United Kingdom.",
  "from": "en",
  "sourceTransliteration": "London is the capital and largest city of England and of the United Kingdom.",
  "targetTransliteration": "London ist die Hauptstadt und grosste Stadt Englands und des Vereinigten Konigreichs.",
}