Getting Started Guide

The Dixit API works with the SOAP web service system and HTTP protocol. The integration of this API into your system or CMS is extremely simple.

Get your API key at dixit.com

Note: To use the Dixit API, you must enter the login details for your Dixit account (email and password), along with your API key.

You can obtain the API key from your account in the "Personal Information" tab..

Start integration

Before any communication with Dixit, it is necessary to obtain a "connection token ". This token is used during a session. It is the Open API Connection function which provides a unique token for each session.

PHP example :
$login = "myLogin"; // your Dixit login
$pwd = "myPwd"; // your Dixit password
$key = "myApiKey"; // your API key

$sClient = new SoapClient("http://api.dixit.com/dixit_api.wsdl",
	array (
		'wsdl_cache' => WSDL_CACHE_NONE,
		'trace' => 1
	));   

$response = $sClient->openApiConnection(array ('login'=>$login, 'pwd'=>$pwd, 'key'=>$key));
$token = $response->return;

This connection token is used by all the other functions.
If you receive this token, it means that you will be able to communicate via the API.

List of functions

openApiConnection()

Opens your connection to the Dixit API.

Input parameters :
array (
	'login' => $login, 
	'pwd' => $pwd, 
	'key' => $key
);

Output parameters :
Object {
	var return; // the connection token to use in all other API calls
}

Examples :
$login = "myLogin"; // your Dixit login
$pwd = "myPwd"; // your Dixit password
$key = "myApiKey"; // your API key

$sClient = new SoapClient("http://api.dixit.com/dixit_api.wsdl",
	array (
		'wsdl_cache' => WSDL_CACHE_NONE,
		'trace' => 1
	));   

$response = $sClient->openApiConnection(array ('login'=>$login, 'pwd'=>$pwd, 'key'=>$key));
$token = $response->return;
getTranslationInfo()

Provides information about a translation when it has been completed

Input parameters :
array (
	'token' => $token, // your connection token
	'id' => $translation_id, // your translation's id
	'html' => $html // optional : if true, the fonction return the translation including html tags
);

Output parameters :
Object {
	var ready; // boolean : true if the translation is finish, false otherwise
	object getTranslationInfoReturn { 
		var idTranslation; // your translation's id
		var idLanguage; // your translation's language id
		var outputText; // the translation text
	}
}

Examples :
class translation {
	var $idTranslation;
	var $idLanguage;
	var $outputText;
	
	function  __construct() {
		$this->idTranslation = 0;
		$this->idLanguage = 0;
		$this->outputText = "";
	}
}

/* Note : Suppose that $token and $sClient are created */
$translationId = 123; // The ID of your translation

$result = $sClient->getTranslationInfo (array ('token'=> $token, 'id' => $translationId));

if ($result->ready) {
	$myTranslation = new translation();
	$myTranslation = $result->getTranslationInfoReturn;
}
getTextInfo()

Provides information about a text.

Input parameters :
array (
	'token' => $token, // your connection token
	'id' => $translation_id, // your text's id
);

Output parameters :
Object {
	object getTextInfoReturn { 
		var source_text; // the source text
		var source_language_id; // the language of yout text
		var category_id; // the category
		var comment; // your comment about this text
		var name; // the name of your text
		var url_photo; // An image URL to show to the translator
	}
}

Examples :
class text {
	var $source_text;
	var $source_language_id;
	var $category_id;
	var $comment;
	var $name;
	var $url_photo;
	
	function  __construct() {
		$this->source_text = "";
		$this->source_language_id = 0;
		$this->category_id = 0;
		$this->comment = "";
		$this->name = "";
		$this->url_photo = "";
	}
}

/* Note : Suppose that $token and $sClient are created */
$textId = 123; // The ID of your text

$result = $sClient->getTextInfo (array ('token'=> $token, 'id' => $textId));

if ($result->ready) {
	$my_text = new text();
	$my_text = $result->getTextInfoReturn;
}
createText()

Creates a new source text on Dixit.

Input parameters :
array (
	'token' => $token, // your connection token
	'text' => object {
		var $source_text; // the source text
		var $source_language_id; // the language of yout text
		var $category_id; // the category
		var $comment; // your comment about this text
		var $name; // the name of your text
		var $url_photo; // An image URL to show to the translator
	}
);

Output parameters :
Object {
	var createTextReturn; // The unique ID of ths new created text
}

Examples :
/* Note : Suppose that $token and $sClient are created, and class text is included */
$text = new text();
$text->source_text = "my source text";
$text->source_language_id = 38; // corresponding to english language
$text->category_id = 55; // category "fashion, clothing, jewelry"
$text->comment = "a comment";
$text->name = "a title";
$text->url_photo = "http://www.domain.com/images/an_image.gif";

$my_text_id = $sClient->createText (array ('token'=> $token, 'text' => $text));

createTranslation()

Creates a new translation on Dixit from a source text and target language.

Input parameters :
array (
	'token' => $token, // your connection token
	'text_id' => $text_id, // Tee unique ID of the source text
	'output_language_id' => $output_language_id, // the id of the target language 
	'proofreading' => $proofreading, // Optional boolean (1 = adds proofreading for this translation. 0 = nothing) 
);

Output parameters :
Object {
	var createTranslationReturn; // The unique ID of ths new created translation
}

Examples :
/* Note : Suppose that $token and $sClient are created. */
$text = new text();
$text->source_text = "my source text";
$text->source_language_id = 38; // corresponding to english language
$text->category_id = 55; // category "fashion, clothing, jewelry"
$text->comment = "a comment";
$text->name = "a title";
$text->url_photo = "http://www.domain.com/images/an_image.gif";

$my_text_id = $sClient->createText (array ('token'=> $token, 'text' => $text));

$output_language_id = 48 // corresponding to "french"
$my_translation_id = $sClient->createTranslation (array ('token'=> $token, 'text_id' => $my_text_id, 'output_language_id' => $output_language_id));

/* Result the création of the translation (id = $my_translation_id) from the source text (id = $my_text_id) to the target language (id = $output_language_id) */

getBalance()

Provides customer information about an account balance.

Input parameters :
array (
	'token' => $token, // your connection token
);

Output parameters :
Object {
	var total_credits; // Your current balance
	var available_credits; // Your available credits
	var captured_credits; // Your frozen credits
}

Examples :
/* Note : Suppose that $token and $sClient are created. */

$my_balance = $sClient->getBalance (array ('token'=> $token));

echo $my_balance->available_credits;
getTextDetail()

Provides details about all the translations relevant to a source text.

Input parameters :
array (
	'token' => $token, // your connection token
	'id' => $my_text_id, // your text's unique ID
);

Output parameters :
Object {
	object textDetail {
		var $source_text;
		var $source_language_id;
		var $category_id;
		var $comment;
		var $name;
		var $url_photo;
	}
	object available_translations Collection {
		var $idTranslation;
		var $idLanguage;
		var $outputText; // will allways be empty
	}
	object pending_translations Collection {
		var $idTranslation;
		var $idLanguage;
		var $outputText; // will allways be empty
	}
	object completed_translations Collection { 
		var $idTranslation;
		var $idLanguage;
		var $outputText;
	
	}
}

Examples :
/* Note : Suppose that $token and $sClient are created. $my_text_id is one of your text */

$my_text_detail = $sClient->getTextDetail (array ('token'=> $token, 'id' => $my_text_id));

print_r $my_text_detail;
/* will print :
object(stdClass)#3 (1) { 
	["getTextDetailResult"]=> object(stdClass)#4 (4) { 
		["textDetail"]=> object(stdClass)#5 (6) { 
			["source_text"]=> string(44) "My source text" 
			["source_language_id"]=> string(2) "38" 
			["category_id"]=> string(2) "55" 
			["comment"]=> string(9) "a comment" 
			["name"]=> string(7) "a title" 
			["url_photo"]=> string(41) "http://www.domain.com/images/an_image.gif" 
		} 
		["available_translations"]=> object(stdClass)#6 (2) { 
			["translation_1"]=> object(stdClass)#7 (4) { 
				["idTranslation"]=> string(3) "530" 
				["idLanguage"]=> string(2) "55" 
				["outputText"]=> string(0) "" 
			} 
			["translation_2"]=> object(stdClass)#8 (4) { 
				["idTranslation"]=> string(3) "538" 
				["idLanguage"]=> string(3) "175" 
				["outputText"]=> string(0) "" 
			} 
		} 
		["pending_translations"]=> object(stdClass)#9 (1) { 
			["translation_1"]=> object(stdClass)#10 (4) { 
				["idTranslation"]=> string(3) "532" 
				["idLanguage"]=> string(3) "132" 
				["outputText"]=> string(0) "" 
			} 
		} 
		["completed_translations"]=> object(stdClass)#11 (1) { 
			["translation_1"]=> object(stdClass)#12 (4) { 
				["idTranslation"]=> string(3) "531" 
				["idLanguage"]=> string(2) "48" 
				["outputText"]=> string(18) "Votre traduction en français" 
			} 
		} 
	} 
}
*/
createTextMulti()

Creates a new source text on Dixit, using the "blocks of text" system. The whole bloc is made as a "table of tables", encoded with Json, whose inputs are set below.

Input parameters :
array (
	'token' => $token, // your connection token
	'text' => object {
		var $source_text; // the source text
		var $source_language_id; // the language of yout text
		var $category_id; // the category
		var $comment; // your comment about this text
		var $name; // the name of your text
		var $url_photo; // An image URL to show to the translator
	}
);

Output parameters :
Object {
	var createTextMultiReturn; // The unique ID of ths new created text
}

Examples :
/* Note : Suppose that $token and $sClient are created, and class textMulti is included */
/* First of all, creation of the multi block text. Each block consists of 3 parameters :
  •   : "content" : The text to translate. Can not be empty.
  •   : "title" : A short text to intruduce this bloc (ex: short description, meta title, ...). Optional.
  •   : "identifier" : A hidden variable that will be useful with the translated text. Optional.

Here id an exemple, with a three blocks translation of a product. */
$array_of_blocks = array (
   array("identifier" => "15487","title"=>"Meta Title","content"=>"The title of my product"),
   array("identifier" => "1548","title"=>"Short description","content"=>"A short description on my product"),
   array("identifier" => "45896","title"=>"Description","content"=>"A long description on my product, with more text ...")
);

/* Now, Json encoding of my well formated array. NOTE : use json_encode options to ensure proper encoding of texts */
$encoded_string_of_blocks = json_encode($array_of_blocks, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);

$text = new text();
$text->source_text = $encoded_string_of_blocks; // My Json encoded string representing array of blocks 
$text->source_language_id = 38; // corresponding to english language
$text->category_id = 55; // category "fashion, clothing, jewelry"
$text->comment = "a comment";
$text->name = "a title";
$text->url_photo = "http://www.domain.com/images/an_image.gif";

$my_text_id = $sClient->createTextMulti (array ('token'=> $token, 'text' => $text));

getTranslationMultiInfo()

Returns information about a translation using the bloc system, when it's finished.

Input parameters :
array (
	'token' => $token, // your connection token
	'id' => $translation_id, // your translation's id
	'html' => $html // optional : if true, the fonction return the translation including html tags
);

Output parameters :
Object {
	var ready; // boolean : true if the translation is finish, false otherwise
	object getTranslationInfoReturn { 
		var idTranslation; // your translation's id
		var idLanguage; // your translation's language id
		var outputText; // the Json encoded translated array of blocks
	}
}

Examples :
/* Note : Suppose that $token and $sClient are created, and translation class included */
$translationId = 123; // The ID of your translation

$result = $sClient->getTranslationMultiInfo (array ('token'=> $token, 'id' => $translationId));

if ($result->ready) {
	$myTranslation = new translation();
	$myEncodedTranslation = $result->getTranslationMultiInfoReturn;
	$myDecodedTranslation = json_decode($myEncodedTranslation->{"outputText"})
}
getCategories()

Returns the list of Dixit categories, as an array encoded with Json.

Input parameters :
array (
	'token' => $token, // your connection token
	'language_id' => $language_id, // The language in which you want the categories
);

Output parameters :
Object {
	var getCategoriesReturn; // string : A Json encoded array containg the categories
}

Examples :
/* Note : Suppose that $token and $sClient are created */
$required_language = 48; // The ID of French language

$result = $sClient->getCategories (array ('token'=> $token, 'language_id' => $required_language));

$in_array_result = json_decode($result->{"getCategoriesResult"});
echo "
".print_r($in_array_result,true)."
"
; /* Will prints */ Array ( [0] => stdClass Object ( [categorie_id] => 37 [content] => Animaux ) [1] => stdClass Object ( [categorie_id] => 38 [content] => Architecture, Urbanisme, Art ) ... )
getLanguages()

Returns the list of Dixit languages, as an array encoded with Json.

Input parameters :
array (
	'token' => $token, // your connection token
	'language_id' => $language_id, // The language in which you want the langauges
);

Output parameters :
Object {
	var getLanguagesReturn; // string : A Json encoded array containg the languages
}

Examples :
/* Note : Suppose that $token and $sClient are created */
$required_language = 48; // The ID of French language

$result = $sClient->getLanguages (array ('token'=> $token, 'language_id' => $required_language));

$in_array_result = json_decode($result->{"getLanguagesResult"});
echo "
".print_r($in_array_result,true)."
"
; /* Will prints */ Array ( [0] => stdClass Object ( [language_id] => 8 [iso_code_2] => ar [content] => Arabe ) [1] => stdClass Object ( [language_id] => 15 [iso_code_2] => bg [content] => Bulgare ) ... )
getWordCount()

Get the word count of the provided text.

Input parameters :
array (
    'token' => $token, // your connection token
    'text' => object {
            var $source_text; // the source text => only mandatory element
	}

);

Output parameters :
Object {
	var getWordCountReturn; // int : number of words in the text.
}

Exemple d'utilisation :
/* Note : Suppose that $token and $sClient are created */

$text = new stdClass();
$text->source_text = "my source text";

$my_text_count = $sClient->getWordCount(array ('token'=> $token, 'text' => $text));

Identifiers

Languages on Dixit

ID Language
8Arabic
19Bengali
15Bulgarian
188Cantonese
60Croatian
28Czech
32Danish
117Dutch
38English (GB)
192English (USA)
41Estonian
45Finnish
48French
191French (Canada)
33German
37Greek
57Hebrew
58Hindi
62Hungarian
73Italian
75Japanese
85Korean
100Latvian
98Lithuanian
184Mandarin
119Norwegian
130Polish
132Portuguese
189Portuguese (Brazil)
136Romanian
137Russian
151Serbian
145Slovak
146Slovenian
40Spanish
23Spanish (Catalan)
190Spanish (Latin American)
155Swedish
157Tamoul
160Thai
166Turkish
172Ukrainian
176Vietnamese

Identifiants des catégories

ID Catégorie
37Animals
38Architecture, Art
40Astrology
42Building industry
41Cars, Mechanics
43Correspondence, Curriculum Vitae, Cover letter
46E-commerce
47Electronics, Electrics, Energy
48Environment, Nature
55Fashion, Clothing
44Food, Œnology
50IT, Technology, Gaming
39Insurance, Finance
45Jewelery, watches
51Literature, Press
52Marketing, Advertising, Public Relations
54Music
56Navigation, Maritime
53Para-pharmacy, Cosmetics
57Politics, Economy
49Real Estate
58Religion, History, Archeology
59Sciences
60Sports
61Tourism, Travelling
62Transport, Logistics