Automatic Machine Translation API

Methods

translate_string [POST]

This method allows authenticated users to translate plain text. Only POST method is allowed.

Request example
{ 
	"api_id" : "<YOUR_API_ID>",
	"api_key" : "<YOUR_API_KEY>",
	"translation_engine" : "nmt" | "apertium" | "apertiumc",
	"language_pair" : "es-eu" | "eu-es",
	"content_type" : "txt" | "html" | "xml",
	"text" : "<ORIGINAL_TEXT>"
}
Response example
{ 
	"original_text" : "<ORIGINAL_TEXT>",
	"translated_text" : "<TRANSLATED_TEXT>",
	"words" : "<WORDS>", #Translated words,
	"execution_time": "73.4", # Execution time in seconds
}
translate_file [POST]

This method allows authenticated users to translate files. Only POST method is allowed. It is an asynchronous method. On successful response, it returns a task_id identifier which allows to check current traslation process status.

Request example
{ 
	"api_id" : "<YOUR_API_ID>",
	"api_key" : "<YOUR_API_KEY>",
	"translation_engine" : "nmt" | "apertium" | "apertiumc",
	"language_pair" : "es-eu" | "eu-es",
	"content_type" : "txt" | "docx" | "xlsx" | "pptx" | "odt" | "ods" | "odp" | "html" | "xml" | "xliff" | "txlf",
	"file" : "<POSTED_FILE>",
	"file_md5" : "<POSTED_FILE_MD5_CHECKSUM>",
	"url" : url | null, # If url base should be set in html files
}
Response example
{ 
	"task_id" : "<TASK_ID>", # Asynchronous task id
}
file [POST]

This method allows authenticated users to check for a particular document translation status. task_id is returned by the translate_file method. Only POST method is allowed.

Request example
{ 
	"api_id" : "<YOUR_API_ID>",
	"api_key" : <YOUR_API_KEY>",
	"task_id" : "<TASK_ID>", # Asynchronous task id
}
Response example Task is running
{
    "finished": False,
    "error": False,
    "percentage": "75",
    "message": "Running translation", # Just an example
}
Task finished without errors. Translation successful
{
	"finished": True,
	"error": False,
	"original_file": "<POSTED_FILE_URL>",
	"trasnlated_file": "<TRANSLATED_FILE_URL>",
	"words": "<WORDS>", #Translated words
	"execution_time": "73.4", # Execution time in seconds
}
Task finished with errors. Unsuccessful translation
{
	"finished": True,
	"error": True,
	"message": "There was an error", # Just an example
}
language_pairs [POST]

This method allows authenticated users to view the allowed language pairs and translation engines. Only POST method is allowed.

Request example
{
        "api_id" : "<YOUR_API_ID>",
        "api_key" : "<YOUR_API_KEY>"
}
Response example
[
    {
        "src": "es",
        "tgt": "eu",
        "engine": "nmt"
    },
    {
        "src": "eu",
        "tgt": "es",
        "engine": "nmt"
    }			    
]
language_detection [POST]

This method allows authenticated users to detect the language of the text. Only POST method is allowed.

Request example
{
        "api_id" : "<YOUR_API_ID>",
	"api_key" : "<YOUR_API_KEY>",
	"text" : "Esto es una prueba"		   
}
Response example
{
    "text": "esto es una prueba",
    "lang": "es",
    "score": -72.19694900512695
}