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()
- getTranslationInfo()
- getTextInfo()
- createText()
- createTranslation()
- getBalance()
- getTextDetail()
- createTextMulti()
- getTranslationMultiInfo()
- getCategories()
- getLanguages()
- getWordCount()
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;
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; }
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; }
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));
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) */
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;
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" } } } } */
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));
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"}) }
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 ""; /* Will prints */ Array ( [0] => stdClass Object ( [categorie_id] => 37 [content] => Animaux ) [1] => stdClass Object ( [categorie_id] => 38 [content] => Architecture, Urbanisme, Art ) ... )".print_r($in_array_result,true)."
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 ""; /* 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 ) ... )".print_r($in_array_result,true)."
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 |
---|---|
8 | Arabic |
19 | Bengali |
15 | Bulgarian |
188 | Cantonese |
60 | Croatian |
28 | Czech |
32 | Danish |
117 | Dutch |
38 | English (GB) |
192 | English (USA) |
41 | Estonian |
45 | Finnish |
48 | French |
191 | French (Canada) |
33 | German |
37 | Greek |
57 | Hebrew |
58 | Hindi |
62 | Hungarian |
73 | Italian |
75 | Japanese |
85 | Korean |
100 | Latvian |
98 | Lithuanian |
184 | Mandarin |
119 | Norwegian |
130 | Polish |
132 | Portuguese |
189 | Portuguese (Brazil) |
136 | Romanian |
137 | Russian |
151 | Serbian |
145 | Slovak |
146 | Slovenian |
40 | Spanish |
23 | Spanish (Catalan) |
190 | Spanish (Latin American) |
155 | Swedish |
157 | Tamoul |
160 | Thai |
166 | Turkish |
172 | Ukrainian |
176 | Vietnamese |
Identifiants des catégories
ID | Catégorie |
---|---|
37 | Animals |
38 | Architecture, Art |
40 | Astrology |
42 | Building industry |
41 | Cars, Mechanics |
43 | Correspondence, Curriculum Vitae, Cover letter |
46 | E-commerce |
47 | Electronics, Electrics, Energy |
48 | Environment, Nature |
55 | Fashion, Clothing |
44 | Food, Œnology |
50 | IT, Technology, Gaming |
39 | Insurance, Finance |
45 | Jewelery, watches |
51 | Literature, Press |
52 | Marketing, Advertising, Public Relations |
54 | Music |
56 | Navigation, Maritime |
53 | Para-pharmacy, Cosmetics |
57 | Politics, Economy |
49 | Real Estate |
58 | Religion, History, Archeology |
59 | Sciences |
60 | Sports |
61 | Tourism, Travelling |
62 | Transport, Logistics |