Ok. I give up. Hundreds of code lines working. Solved most of my issues by reading and reading and reading. Retrieved lots of data, stored it, did fancy things with it...
... and finally ... I got stuck. And finally I have to switch from passive perl monks support to active support.
So, deardear Monks, what - generally speaking - is wrong with my code (credit: not my code, copypasted from somewhere)?:
To be more specific: The error messages are:my $ua = LWP::UserAgent->new; my $server_endpoint = "https://api.someserver.com/v1/"; my $req = HTTP::Request->new(POST => $server_endpoint); $req->authorization_basic('myusername', 'mypassword'); my $post_data = "{ 'parm1': '$valueasscalar', 'parm2': 'TRUE',and: + 'so on'}"; $req->content($post_data); my $resp = $ua->request($req); if ($resp->is_success) { my $message = $resp->decoded_content; print "Received reply: $message"; } else { print "HTTP POST error code: ", $resp->code; print "HTTP POST error message: ", $resp->message; }
HTTP POST error code: 400 HTTP POST error message: Bad Request
Is there something wrong with my code? Or is the code ok, but something wrong with the parameters?
All help is as appreciated as ever when reading on perlmonks!
Thanks, Trace on
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |