Setup

The Localization API establishes the connection using the HTTPS protocol. It uses standard HTTP response codes, authentication, and verbs.

The REV-APPNAME parameter in the Header will identify the requested API. The API will recognize the default settings like domain, languages by the REV-APP-ID, and REV-API-KEY for each customer account.

Note - On receiving your request, the REV-APP-ID and the REV-API-KEY are forwarded to your email ID to test the API.

Authentication

The Localization API will use the App Id and API key to authenticate requests. Your credentials carry many privileges, so be sure to keep them secure.

Use your App Id and API Key by assigning it to REV-APP-ID and REV-API-KEY, respectively.

How Does API work?

The process to localize the content is:

1. Post the request by:

a. Enter the valid REV-APPNAME, REV-APP-ID, and REV-API-KEY

b. Specify the Source language & Target language(s) code

c. Enter the content you want to localize and mention the domain

2. On posting the request:

a. The API will validate user credentials

b. Validate the key-value pairs in the API request

c. If all the information is valid, then initially, the API will refer to the Database (Lookup DB & Template DB), to localize the content

or else,

If the content is not available in the Database, then the NMT technology is adapted.

3. On successfully translating the content, the API returns the content in the requested target language(s).

Code Snippets for Integration

Translate content to one target language

Request

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'Content-Type: application/json' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APP-ID: <YOUR APP-ID>' \
--header 'src_lang: en' \
--header 'tgt_lang: hi' \
--header 'domain: generic' \
--header 'REV-APPNAME: localization' \
--header 'version: 3.0' \
--data-raw '{
"data": ["Reverie Language Technologies was established in 2009.", "The company head office is located in Bengaluru."],
    "nmtMask": true,
    "nmtMaskTerms" : ["Reverie Language Technologies"],
    "enableNmt": true,
    "enableLookup": true
}'

Response

{
    "responseList": [
        {
            "inString": "Reverie Language Technologies was established in 2009.",
            "outString": "रेवरी लैंग्वेज टेक्नोलॉजीस की स्थापना 2009 में की गई थी।",
            "apiStatus": 3
        },
        {
            "inString": "The company head office is located in Bengaluru.",
            "outString": "कंपनी का प्रधान कार्यालय बंगलुरू में स्थित है।",
            "apiStatus": 3
        }
    ],
    "tokenConsumed": 102
}

Translate content to multiple target languages

Request

curl --location --request POST 'https://revapi.reverieinc.com/' \
--header 'Content-Type: application/json' \
--header 'REV-API-KEY: <YOUR API KEY>' \
--header 'REV-APP-ID: <YOUR APP-ID>' \
--header 'src_lang: en' \
--header 'tgt_lang: hi,ta' \
--header 'domain: generic' \
--header 'REV-APPNAME: localization' \
--header 'version: 3.0' \
--data-raw '{
"data": ["Reverie Language Technologies was established in 2009.", "The company head office is located in Bengaluru."],
    "nmtMask": true,
    "nmtMaskTerms" : ["Reverie Language Technologies"],
    "enableNmt": true,
    "enableLookup": true
}'

Response

{
    "responseList": [
        {
            "inString": "Reverie Language Technologies was established in 2009.",
            "apiStatus": 3,
            "outStrings": {
                "hi": "रेवरी लैंग्वेज टेक्नोलॉजीस की स्थापना 2009 में की गई थी।",
                "ta": "ரெவரி லாங்வேஜ் டெக்னாலஜிஸ் 2009 இல் நிறுவப்பட்டது ."
            },
            "api_statuses": {
                "hi": 3,
                "ta": 3
            }
        },
        {
            "inString": "The company head office is located in Bengaluru.",
            "apiStatus": 3,
            "outStrings": {
                "hi": "कंपनी का प्रधान कार्यालय बंगलुरू में स्थित है।",
                "ta": "நிறுவனத்தின் தலைமை அலுவலகம் பெங்கலூரில் அமைந்துள்ளது ."
            },
            "api_statuses": {
                "hi": 3,
                "ta": 3
            }
        }
    ],
    "tokenConsumed": 204
}

Error Response

{
    "message": "unauthorized to use this src/tgt language",
    "status": 403
}

Last updated