Name: {name}
Translator since: {translator_since}
From: {from}
Collaboration with you: {collaboration}
{about}
{fieldofexpertise}
 {name}

Nativy Connect

nativy translations
Description Posts some text contents to be stored and used in ordering process.
URL /connect/contentbundle

Parameters
api_key (required) string The public API key of the user. (Details: Authentication )
timestamp (required) string The current UTC timestamp (seconds from 1/1/1970 until UTC now). (Details: Authentication )
api_sign (required) string The timestamp encoded with HMAC SHA1 in use of the private key. (Details: Authentication )
language_from (required) string The short key of the source language of your text. (Details: /languages GET)
text_from (required1) array A string/string array of key/value pairs that should be translated by nativy. Provide an unique key for each text part, so you can assign the translated texts to the right place in your application later (see example call below for more details).
contentid_list (required1) new array A string (GUID) array of the contentids which are obtained by other methods. (See more: /contentfile POST)
general_input (required1) string A string which that can have different formats the the format should be specified by general_input_type.
general_input_type (required2) string The formatting of the text which is being transmitted in general_input.

Currently we support following formats:

  • 'plain' : Plain text. The text is considered as one translation content and all comprising words are counted.
  • 'xliff' : Xliff v1.2 formatted text. Each "trans-unit" becomes a separate content and only the words within "source" tags are counted.
  • 'contentid' new : Required when contentid_list is provided.

1: Only one of these fields is required to contain a none-empty value. If text_from is not empty, then general_input will be ignored.

2: Only required in combination with general_input. If general_input is empty, this field also will be ignored.


Example call (text_from)

                $url = 'http://www.nativytest.com/connect/contentbundle';
        	    $api_key = 'iQU5lBuEjYFvx2EU2o>bp*u02x^Bmie3d}pg-pU^MZ&%mobYM&x7SHY+41u7PHEh';
        	    $private_key = '4i2j_F|=lcqNmxPaxtxsX-veXJ)i+w(hq[_J&(r{Pn[jyT&)xt*Usp3K%B_jv{tP';
        	    $timestamp = gmdate('U');
	            $hmac = hash_hmac('sha1', $timestamp, $private_key); 
	        
	            $text_from1 = array('Key' => 'mnuFile', 'Value' => 'File');
	            $text_from2 = array('Key' => 'mnuHelp', 'Value' => 'Help');
	            $text_from3 = array('Key' => 'about_text', 
	        					    'Value' => 'This is a demo about text.');

	            $order = array(
	        	    'api_key' => $api_key,
 			   	    'api_sign' => $hmac,
 			   	    'timestamp' => $timestamp,
	        	    'language_from' => 'en',
	        	    'text_from' => array($text_from1, $text_from2, $text_from3)
	            );
	        
	            $order = json_encode($order);
	        
	            $ch = curl_init($url); 
	            curl_setopt($ch, CURLOPT_URL, $url); 
			    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
	            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
	            curl_setopt($ch, CURLOPT_POST, 1); 
	            curl_setopt($ch, CURLOPT_POSTFIELDS, $order);
	            $response = curl_exec($ch);
	            curl_close($ch);

        	    echo ($response);
            

Example call (XliffInput)

                $url = 'http://www.nativytest.com/connect/contentbundle';
        	    $api_key = 'iQU5lBuEjYFvx2EU2o>bp*u02x^Bmie3d}pg-pU^MZ&%mobYM&x7SHY+41u7PHEh';
        	    $private_key = '4i2j_F|=lcqNmxPaxtxsX-veXJ)i+w(hq[_J&(r{Pn[jyT&)xt*Usp3K%B_jv{tP';
        	    $timestamp = gmdate('U');
	            $hmac = hash_hmac('sha1', $timestamp, $private_key); 
	        
	            $general_input = '   
File Help This is a demo about text
' $order = array( 'api_key' => $api_key, 'api_sign' => $hmac, 'timestamp' => $timestamp, 'language_from' => 'en', 'general_input' => $general_input, 'general_input_type' => 'xliff' ); $order = json_encode($order); $ch = curl_init($url); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json')); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $order); $response = curl_exec($ch); curl_close($ch); echo ($response);

Return values

Posting a Content Bundle returns an object containing a reference code to use in further steps of creating an order.

contentbundlereference  string The reference of the posted bundle to be used in further steps of createing an order.

Example return values

            {
                "contentbundlereference":"1c271485-edb4-4b9e-805d-a91f4e9664e1"
            }