This is an old revision of the document!


In this PERL example, calling the GetHashSignature function will return the proper hash signature value to connect to the API and submit the request. The Hash Signature in this example is being saved to the $hash_signature variable. Please note that you must have the PERL modules Digest::HMAC_SHA1 and POSIX installed on the server for this to work.

### Define the API Variables and Parameters ###
$apiuser = "efQvdjyar";
$apipass = "IvQ01brhg";
$apikey = "lvPaGd3DXhP17uCF5br8cv0Rt";
use POSIX qw(strftime);
$timestamp = strftime "%Y-%m-%dT%H:%M:%SZ", gmtime;

### Call the Function and send the API Parameters ###
$hash_signature = GetHashSignature($apiuser, $apipass, $apikey, $timestamp);

### Here is the function ###
sub GetHashSignature {
	my $apiuser = shift(@_);
	my $apipass = shift(@_);
	my $apikey = shift(@_);
	my $timestamp = shift(@_);
	my $concat = $apiuser."".$apipass."".$timestamp;
	my $hmac = Digest::HMAC_SHA1->new($apikey);
	$hmac->add( $concat );
	my $localhash = $hmac->digest;
	my $encodedhash = encode_base64($localhash);

	$encodedhash =~ s/\n\r//gi;
	$encodedhash =~ s/\r//gi;
	$encodedhash =~ s/\n//gi;

	$encodedhash = decodeURL($encodedhash);
	return $encodedhash;
}
Print/export