Getting a list of supported languages

Before getting started

To try the examples in this section:

  1. On the billing page, make sure that the payment account has the ACTIVE or TRIAL_ACTIVE status. If you don't have a payment account, create one.
  2. Make sure you have installed the cURL utility that is used in the examples.
  3. Get the ID of any folder that your account is granted the editor role or higher for.
  4. Get an IAM token for your Yandex account.

To perform these operations on behalf of the service account:

  1. Assign the editor role or a higher role to the service account for the folder where it was created.
  2. Do not specify the folder ID in the request: the service uses the folder where the service account was created.
  3. Choose the authentication method: get an IAM token or API key.

Get the list of supported languages

Get the list of supported languages using the listLanguages method:

$ export FOLDER_ID=b1gvmob95yysaplct532
$ export IAM_TOKEN=CggaATEVAgA...
$ curl -X POST \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer ${IAM_TOKEN}" \
    -d "{\"folder_id\": \"${FOLDER_ID}\"}" \
    "https://translate.api.cloud.yandex.net/translate/v2/languages"

The response will contain a list of language names in the corresponding language:

{
    "languages": [
        {
        "code": "az",
        "name": "azərbaycan"
        },
        {
        "code": "sq",
        "name": "shqip"
        },
        {
        "code": "am",
        "name": "አማርኛ"
        },
        {
        "code": "en",
        "name": "English"
        },
        ...
    ]
}