Documentation

getLangs method

Returns a list of translation directions supported by the service.

Description

string[] getLangs(string key);

Input parameters

List of input parameters:

ParameterTypeDescription
Mandatory
key string API key. Get a free API key on this page.

Sample request:

XML interface:

https://dictionary.yandex.net/api/v1/dicservice/getLangs?key=APIkey

JSON interface:

https://dictionary.yandex.net/api/v1/dicservice.json/getLangs?key=APIkey

JSONP interface (for the "myCallback" function):

https://dictionary.yandex.net/api/v1/dicservice.json/getLangs?key=APIkey&callback=myCallback

Returns

In the XML interface it returns an XML document with the root element ArrayOfString. For example:

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfString>
  <string>ru-ru</string>
  <string>ru-en</string>
  <string>ru-pl</string>
  <string>ru-uk</string>
  <string>ru-de</string>
  <string>ru-fr</string>
         ...
  <string>it-ru</string>
  <string>it-en</string>
  <string>tr-ru</string>
  <string>tr-en</string>
</ArrayOfString>

Table 1. Error codes

CodeValueDescription
ERR_KEY_INVALID 401

Invalid API key.

ERR_KEY_BLOCKED 402

This API key has been blocked.

In the JSON interface, instead of XML elements, JavaScript objects are returned with the same names and semantics:

["ru-ru","ru-en","ru-pl","ru-uk","ru-de","ru-fr","ru-es","ru-it","ru-tr","en-ru","en-en","en-de","en-fr","en-es","en-it","en-tr","pl-ru","uk-ru","de-ru","de-en","fr-ru","fr-en","es-ru","es-en","it-ru","it-en","tr-ru","tr-en"]

In the JSONP interface, the same JavaScript objects are returned to a callback function (for example, "myCallback"):

myCallback(["ru-ru","ru-en","ru-pl","ru-uk","ru-de","ru-fr","ru-es","ru-it","ru-tr","en-ru","en-en","en-de","en-fr","en-es","en-it","en-tr","pl-ru","uk-ru","de-ru","de-en","fr-ru","fr-en","es-ru","es-en","it-ru","it-en","tr-ru","tr-en"])
getLangs