fbpx
3.01 Login


Connection URL

TEST URL  http://nap.dev.icash.bg/clientapi/v1/login
( AL ) PRODUCTION URL  https://v1.icash.al/clientapi/v1/login
( BG ) PRODUCTION URL https://v5.icash.bg/clientapi/v1/login

 

POST Request params

Param Description Type Required
api_key API Key String YES
nonce Nonce Integer YES
signature Signature String YES
WareHouseID Warehouse ID Integer YES
UserID User ID Integer YES

 

JSON Response on success

Param Description Type Required
nonce Nonce from request Integer YES
status Status Integer
1 – on success
YES
data Result result YES

 

Example POST:

 
{
    "nonce": "1552989761",
    "status": 1,
    "data": {
        "session_id":"66a891e8b4d7d018d230363bcd0adfbd"
    }
}
JSON Response on fail
Param Description Type Always existt
nonce Nonce от заявката Integer YES
status Result status Integer
0 – on fail
1 – success
YES
error_message Error message String NO

 

Example result:

{ „nonce“: „1552990302“, „status“: 0, „error_message“: „Authentication Error“ }

Sample PHP Code:

<?php
//initial params
$g_cnt=0; // additional counter for nonce
$url="https://v5.nap.dev.icash.bg/clientapi/v1/login";
$api_key='5kdkuujr8l50iv6yp504qxn2grnlhm2h'; // from user settings
$secret_key='0ptpe0rekdtasktyj1nhjxhzbz1bk5n3'; // from user settings
$WareHouseID="785"; // warehouse ID
$UserID="1"; // from user list// calculate signature
$nonce=time()+$g_cnt; // create always unique and increment value
$message = $nonce.$WareHouseID.$api_key;
$signature = strtoupper(bin2hex(hash_hmac('sha256',$message, $secret_key,true)));
$fields = [
	'api_key' => $api_key,
	'nonce' => $nonce,
	'signature' => $signature,
	'WareHouseID' => $WareHouseID,
	'UserID' => $UserID
];
$fields_string = http_build_query($fields);
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_POST, count($fields));
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
$ret=json_decode($result);
// check result
var_export($ret);
?>

 

Безплатна консултация



Безплатна консултация



Безплатна консултация




Безплатна консултация




Безплатна консултация




Безплатна консултация