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' . );
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Post using LWP useragent curl post request to useragent request
by ikegami (Patriarch) on May 26, 2018 at 05:32 UTC | |
by smarthacker67 (Beadle) on May 26, 2018 at 13:08 UTC | |
by poj (Abbot) on May 26, 2018 at 15:10 UTC | |
by smarthacker67 (Beadle) on May 26, 2018 at 20:47 UTC | |
by poj (Abbot) on May 26, 2018 at 21:11 UTC | |
| |
Re: Post using LWP useragent curl post request to useragent request
by hippo (Bishop) on May 25, 2018 at 21:52 UTC | |
by smarthacker67 (Beadle) on May 26, 2018 at 12:10 UTC |
Back to
Seekers of Perl Wisdom