in reply to 400 bad request curl post
Automatic conversion of your curl command line to Perl using HTTP::Request::FromCurl (via curl-to-lwp gives the following:
#!perl use strict; use warnings; use WWW::Mechanize; use HTTP::Request; my $ua = WWW::Mechanize->new(); my $r = HTTP::Request->new( 'POST' => 'https://api.blockchain.info/v2/receive/balance_update', [ 'Accept' => '*/*', 'Host' => 'api.blockchain.info:443', 'User-Agent' => 'curl/7.55.1', 'Content-Length' => '169', 'Content-Type' => 'text/plain', ], '{"key":"[your-key-here]","addr":"183qrMGHzMstARRh2rVoRepAd919sGgMHb", +"callback":"https://mystore.com?invoice_id=123","onNotification":"KEE +P", "op":"RECEIVE", "confs": 5}' ); my $res = $ua->request( $r, ); __END__ Created from curl command line curl -H "Content-Type: text/plain" --data '{"key":"[your-key-here]","a +ddr":"183qrMGHzMstARRh2rVoRepAd919sGgMHb","callback":"https://mystore +.com?invoice_id=123","onNotification":"KEEP", "op":"RECEIVE", "confs" +: 5}' https://api.blockchain.info/v2/receive/balance_update
You'll note how the request is different from your setup of the request. Most of that is likely due to not duplicating the parameters faithfully.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: 400 bad request curl post
by bigup401 (Pilgrim) on Dec 06, 2018 at 11:39 UTC | |
by bigup401 (Pilgrim) on Dec 06, 2018 at 11:50 UTC | |
by Corion (Patriarch) on Dec 06, 2018 at 11:52 UTC |