am trying to parse bitstamp api

but am getting this error

Error: {"status": "error", "reason": "Invalid nonce", "code": "API0004"}

API documentation https://www.bitstamp.net/api/

#!/usr/bin/perl use strict; use warnings; use URI qw(); use Time::HiRes qw(gettimeofday); use Digest::SHA qw(hmac_sha256_hex); use LWP::UserAgent; my $uri = URI->new(); my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, ); $ua->agent("MyApp/0.1"); my $apiKey = 'Jp'; my $apiSecret = '2ULKB1'; my $urlcb = "https://www.bitstamp.net/api/v2/usdt_withdrawal/"; my $url = URI->new($urlcb); my $urlpath = $url->path(); my $timestamp = int (gettimeofday * 1000); my $nonce = int(rand(1000000)); my %params = $uri->query_form( 'currency' => "USDT", 'network' => "ethereum", 'address' => "", 'amount' => "4", ); my $signature = hmac_sha256_hex($nonce.'POST'.$urlpath.%params, $apiSe +cret); my %payload = ( "X-Auth" => $apiKey, "X-Auth-Signature" => $signature, "X-Auth-Nonce" => $nonce, "X-Auth-Timestamp" => $timestamp, "X-Auth-Version" => 'v2', "Content-Type" => 'application/x-www-form-urlencoded' ); my $req = HTTP::Request->new(POST=>$url); $req->header(%payload); $req->content(%params); my $resp = $ua->request($req); if($resp->is_success){ print $resp->content ."\n"; } else{ print "Error: " . $resp->content; }

In reply to Invalid nonce by frank1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.