i have been able to make this API to work, and am successfully interacting with it now

Am trying to make a post with this data

my $url_query = "currency=usdt"."&amount=20"."&address=0x55Dc816924e33 +CA50830A"."&destination_tag=None";

but am getting this error

{"status": "error", "reason": {"amount": ["This field is required."]}}
 API Documentation Section : https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal

Full code

#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use Digest::SHA qw(hmac_sha256_hex); use UUID::Tiny ':std'; use URI::Escape; use JSON; use Time::HiRes qw(time); use JSON::XS; sub write_call_back { my ($data, $userp) = @_; ${$userp} .= $data; return length($data); } sub url_encode { my ($data) = @_; return uri_escape($data); } my $api_key = "api_key"; my $api_secret = "api_secret"; my $timestamp = int(time() * 1000); my $nonce = create_uuid_as_string(UUID_V4); my $x_auth = "BITSTAMP $api_key"; my $x_auth_nonce = $nonce; my $x_auth_timestamp = $timestamp; my $x_auth_version = "v2"; my $content_type = "application/x-www-form-urlencoded"; my $payload = url_encode('{"offset":1}'); my $http_method = "POST"; my $url_host = "www.bitstamp.net"; my $url_path = "/api/v2/usdt_withdrawal/?"; my $url_query = "currency=usdt"."&amount=20"."&address=0x55Dc816924e33 +CA50830A"."&destination_tag=None"; my $data_to_sign = join('', $x_auth, $http_method, $url_host, $url_path, $url_query, $content_type, $x_auth_nonce, $x_auth_timestamp, $x_auth_version, +$payload ); my $x_auth_signature = hmac_sha256_hex($data_to_sign, $api_secret); my $ua = LWP::UserAgent->new; my $url = "https://$url_host$url_path$url_query"; my $req = HTTP::Request->new(POST => $url); $req->header('X-Auth' => $x_auth); $req->header('X-Auth-Signature' => $x_auth_signature); $req->header('X-Auth-Nonce' => $x_auth_nonce); $req->header('X-Auth-Timestamp' => $x_auth_timestamp); $req->header('X-Auth-Version' => $x_auth_version); $req->header('Content-Type' => $content_type); $req->content($payload); my $resp = $ua->request($req); if ($resp->is_success) { print $resp->content; } else { print "HTTP POST error code: ", $resp->code, "\n"; print "HTTP POST error message: ", $resp->message, "\n"; }

In reply to Re^11: Invalid nonce by frank1
in thread 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.