Post
{leadType} is one of email/text/chat/form/call
<?php
/*
* The below code demonstrates signature generation logic for the web service 'Dashboard Metrics - Dealer Level'
**/
//build your param array with all the params for your web service shown under 'Parameters' section, except the 'sig' param
$secret = 'yourapisecret';
$params = array(
'keyId' => 'yourapikey',
'dealer' => 1111,
'level' => 'dealer',
'startDate' => '2019-04-01',
'endDate' => '2019-04-30'
);
//sort the array by key (ascending order) and maintain the key/value pairs association
ksort($params);
//generate url-encoded query string from the params array
$queryString = http_build_query($params);
//generate a one-way hash using SHA-1 algorithm (hash function must return raw binary data)
//pass the hash through Base-64 encoding, and then through url-encode to get the signature
$signature = urlencode(base64_encode(hash_hmac('sha1', $queryString, $secret, TRUE)));
echo $signature; //hLeucA7rdmy5kqGrCfMSnMpeP28=
<?php
/*
* The below code demonstrates signature generation logic for the web service 'Dashboard Metrics - Dealer Level'
**/
//include the required libraries
var httpBuildQuery = require('http-build-query');
var crypto = require('crypto');
var urlencode = require('urlencode');
//build your param array with all the params for your web service shown under 'Parameters' section, except the 'sig' param
var secret = 'yourapisecret';
var params = {
'keyId' : 'yourapikey',
'dealer' : 1111,
'level' : 'dealer',
'startDate' : '2019-04-01',
'endDate' : '2019-04-30'
};
//sort the array by key (ascending order) and maintain the key/value pairs association
var ordered = {};
Object.keys(params).sort().forEach(function(key) {
ordered[key] = params[key];
});
//generate url-encoded query string from the params array
var queryString = httpBuildQuery(ordered);
//generate a one-way hash using SHA-1 algorithm
//pass the hash through Base-64 encoding, and then through url-encode to get the signature
var signature = urlencode(crypto.createHmac('sha1', secret).update(queryString).digest('base64'));
console.log(signature); //hLeucA7rdmy5kqGrCfMSnMpeP28=