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

Nativy Connect

nativy translations

Every user of nativy connect has to register with nativy and generate a public and a private key on the nativy website.

These keys are used by nativy connect to identify the user who made the request.

Every REST call must provide the following parameters to authenticate:

  • api_key
    The public key. nativy connect determines the user who is requesting by this key.
  • timestamp
    The current UTC timestamp (seconds from 1/1/1970 until UTC now).
  • api_sign
    The timestamp encoded with HMAC SHA1 in use of the private key.
    The api_sign is valid for only one request which must be made within 10 minutes!

Example call with authentication

                $url = 'http://localhost/connect/order';
        	    $api_key = 'iQU5lBuEjYFMx2EU2o>bp*u02K^Bmie3d}pg-pU^MZ&%mobYM&x7SHY+41u7PHEh';
        	    $private_key = '4i2j_F|=lUqNmxPMxtxsX-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' => gmdate('U'),
	        	    'callbacklink' => 'http://localhost/nativyconnect_callback.php',
	        	    'language_from' => 'en', 
	        	    'language_to' => 'de',
	        	    '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);