LOADING....

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.

Api Dixit

1) 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.


2) 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.

3) The Dixit types

Dixit uses identifiers for certain data, such as categories or languages. You will find the identifiers necessary to effectively communicate your information via the links below.



4) List of functions

Discover the list of functions of the Dixit API.




openApiConnection()


Description : 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;

top

getTranslationInfo()


Description : 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;
}


top

getTextInfo()


Description : 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;
}


top

createText()


Description : 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));



top

createTranslation()


Description : 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) */



top

getBalance()


Description : 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;


top

getTextDetail()


Description : 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" 
			} 
		} 
	} 
}
*/

top

New

The Dixit API is improving and offers now the possibility to separate a translation into several blocs. In this way, you can easily translate a source text which is composed of several short texts (eg. a product description) and still keep the homogeneity of the project. This system will be useful to you, especially when you need to integrate the translated text into your site.


createTextMulti()


Description : 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));



top

getTranslationMultiInfo()


Description : 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"})
}


top

getCategories()


Description : 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 "<pre>".print_r($in_array_result,true)."</pre>";

/* Will prints */
Array
(
    [0] => stdClass Object
        (
            [categorie_id] => 37
            [content] => Animaux
        )

    [1] => stdClass Object
        (
            [categorie_id] => 38
            [content] => Architecture, Urbanisme, Art 
        )
	...
)



top

getLanguages()


Description : 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 "<pre>".print_r($in_array_result,true)."</pre>";

/* 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
        )
	...
)



top