smarthacker67 has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks I am trying to create equivalent post request using LWP::Useragent
my request looks like thiscurl ENDPOINT \ -H "Authorization: Bearer ACCESS_TOKEN" -X POST \ -F attributes='{"name":"test.txt", "parent":{"id":"0"}}' \ -F file=@test.txt
but not working getting 400 response Can some one help me. I am actually trying to upload the file to the endpoint with the curl I am able to but looking for equivalent LWP useragent request.my $json = encode_json {"name" => "test.txt", "parent" => {"id" => 0}} +; my $resp = $ua->post( ENDPOINT , {file => <$fh> ,'attributes'=>$json }, 'Authorization' => 'Bearer ' . $token , Content_Type => 'multipart/form-data' . );
Back to
Seekers of Perl Wisdom