How Does API Work?

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

  • Pass valid login credentials:

    • Rev App ID
    • App Key
  • Select Source language & Target language

  • Post Source Content

  • Validate user credentials & load default account settings

  • Return content in Target language

cURL 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 'cnt_lang: en' \
--header 'REV-APPNAME: transliteration' \
--header 'REV-APPVERSION: 2.0' \
--data-raw '{"data": ["Reverie Language Technologies ltd website address is www.reverieinc.com"],
"isBulk" :false,
"ignoreTaggedEntities" : false
}'

Response

{
	"responseList": [
    	{
        	"inString": "Reverie Language Technologies ltd website address is www.reverieinc.com ",
        	"outString": [
            	"रेवरी लैंग्वेज टेक्नोलॉजीस लिमिटेड वेबसाइट एड्रेस इज़ www.reverieinc.com"
        	],
        	"status": 2
    	}
   ]
}

Transliterating Multiple sentences

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 'REV-APPNAME: transliteration' \
--header 'domain: generic' \
--header 'cnt_lang: en' \
--header 'REV-APPVERSION: 2.0' \
--data-raw '{"data": [
	"Reverie Language Technologies is located in Bengaluru ",
	"The address is Jio Avana, Bellandur, Bengaluru -560102",
	"The website address is www.reverieinc.com."
  ],
  "isBulk": false,
  "ignoreTaggedEntities": false
}'

Response

{
	"responseList": [
    	{
        	"inString": "Reverie Language Technologies is located in Bengaluru ",
        	"outString": [
            	"रेवरी लैंग्वेज टेक्नोलॉजीस इज़ लोकेटेड इन बेंगलुरु "
        	],
        	"status": 2
    	},
    	{
        	"inString": "The address is Jio Avana, Bellandur, Bengaluru -560102",
        	"outString": [
            	"द एड्रेस इज़ जियो अवाना, बेल्लन्दूर, बेंगलूरु -560102"
        	],
        	"status": 2
    	},
    	{
        	"inString": "The website address is www.reverieinc.com",
        	"outString": [
            	"द वेबसाइट ऍड्रेस इज़ www.reverieinc.com"
        	],
        	"status": 2
    	}
	]
}

API References

HTTP Request URL

URL ElementsSample URL
https://(hostname)https://revapi.reverieinc.com/

Headers

Content-Type
string
required

The format of the data to be posted: application/json

REV-API-KEY
string
required

A unique key/token provided by Reverie to identify the user using the Localization API.

REV-APP-ID
string
required

The unique account ID to identify the user and the default account settings.

REV-APPNAME
string
required

The parameter to identify the API : transliteration

REV-APPVERSION
string
required
  • The version refers to the specific iteration of the API that is being called.
  • Note: The default version is 2.0.
src_lang
string
required
  • The script used in the input text.
  • Example : or, hi, bn
  • Refer to section Language Codes for valid language code.
tgt_lang
string
required
  • The script to which you want to convert the input text.
  • Example : or, hi, bn
  • Refer to section Language Codes for valid language code.
domain
string
required
  • The Domain refers to the universe in which you use the Transliteration . Example- Health Care, Insurance, Legal, etc.
  • Refer to section Domain Codes for valid language code.
cnt_lang
string
  • The language of the words in the input text.
  • Refer to section Domain Codes for valid language code.
  • Example:
    data: "Singh Sahab aap Kahan the."
    In the example above, the Hindi language words are written in the English language script (Roman Script). So cnt_lang = "hi".
  • Note: This is an optional parameter. If no value is provided, by default the value is the same as src_lang.

Request

data
array[]
required
  • List of input text for transliteration.
isBulk
boolean
  • Specify whether the API should initially search in the Exception DB to transliterate the input text.
  • Note - By default, the isBulk= true and will not search in the Exception DB.
noOfSuggestions
integer
  • Mention the number of transliteration suggestions the API should return for the input text.
  • Note - By default, the noOfSuggestions = 1, means the API will return only one transliteration suggestion for the input string.
  • Example: Consider noOfSuggestions = 2
    Source ContentTarget Content
    Rama1. रामा
    2. रमा
abbreviate
boolean
  • The abbreviate will Validate whether any Abbreviations/ Acronyms are passed in the input text and will transliterate it accurately.
  • Note - By default, the abbreviate = true
  • Note - If the value is false, the API will consider the abbreviation as a word and transliterate it to the nearest available word.
  • Note - In the input text, pass the abbreviations in upper case.
convertNumber
string
  • The feature to screen the non-dictionary words used in a sentence. In other words, the mask will indicate the words that should not be translated into the target language.
  • Note - By default, the enableLookup = true.
  • Note - To set the nmtMask = true, it is mandatory the src_lang = en (English).
  • Description: Specify whether to convert the numbers in the input text to the target language script based on the value type.
  • Three types of values for this parameter:
    • local: This value can convert the input number to the target language script.
      Example:
      Source StringTarget String
      2020.04२०२०.०४
    • words: This value can convert numbers into words with respect to the target language.
      Example:
      Source StringTarget String
      505पांच सौ पांच
    • roman: This value can convert Roman numbers to English numbers.
      Example:
      • If the user types sector V in English, the transliteration would be सेक्टर 5 in Hindi.
      • Block II will be transliterated as ब्लॉक 2.
ignoreTaggedEntities
boolean
  • Specify whether you want to retain the entities like email ID and URL in the input script.
  • Note: By default, the ignoreTaggedEntities = true and will transliterate the email ID and URL into the target language script.
  • Example: Consider ignoreTaggedEntities = false
    Source StringTarget String
    Check product details in www.reverieinc.comचेक प्रोडक्ट डिटेल्स इन www.reverieinc.com
convertOrdinal
boolean
  • This is used for transliterating ordinal values to English numbers.
  • Note - Default value = False.
  • Example: If the user types 15th Main in English, the transliteration would be 15 मेन in Hindi.
abbreviationWithoutDot
boolean
  • This is used to produce the abbreviation output without a dot.
  • Note - Default value = False.
  • Example: If a user wants an abbreviation output without a dot and is given SMS as an input, then the result would be एसएमएस.

Response

responseList
array[]
  • The API will return the string(s) in the target language script.
inString
string
  • The input text in the source language script.
outString
string
  • A string which is the result of converting the input text to the output script
api_status
integer
  • Status of API – successful/fail.
  • By default, the api_status = 2 for all the successful transactions.

Handling Errors

The Transliteration API raises exceptions for many reasons, such as failed conversions, invalid parameters, authentication errors, and network unavailability. It will provide more specific machine-readable messages with an error response so that users can react to errors more effectively.

Refer to: API Messages section to know the error code and corresponding messages.

{
    "documentation": "https://revup.reverieinc.com/dashboard/documentation",
    "message": "Oops! Something wrong happened",
    "error_cause": "Required String parameter 'target_lang' is not present",
    "status": "BAD_REQUEST"
}

API Messages

Status CodeStatus TypeMessageDescription
200Success/OK-Successfully executed the request.
400Bad RequestMessage depending on the missing parameterIncorrect request format or data posted incorrectly.
403ForbiddenInvalid REV-API-KEY or REV-APP-IDEntered invalid credentials.
403Forbiddenusage exhaustedThe provided credits or character limit is exhausted.
403ForbiddenAPI key expiredThe API key provided to a user is expired.
403Forbiddenunauthorized to use this src/tgt languageInvalid language code passed or user cannot use the defined language code.
403Forbiddenunauthorized to use this APIThe REV-APPNAME entered is invalid, or the user is not authorized to use it.
500Internal Server ErrorInternal Server ErrorAn error occurred with the API.