in reply to Post using LWP useragent curl post request to useragent request
For starters, that syntax doesn't match any of the documented calling conventions:
POST $url POST $url, Header => Value,... POST $url, $form_ref, Header => Value,... POST $url, Header => Value,..., Content => $form_ref POST $url, Header => Value,..., Content => $content
You want
my $attributes = { name => "test.txt", parent => { id => 0 }}; $ua->post(ENDPOINT, Content_Type => 'form-data', Authorization => "Bearer $token", Content => [ attributes => encode_json($attributes), file => [ "test.txt" ], ], );
Use the following if you don't want to read from disk:
[ undef, "test.txt", Content => $file_contents ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Post using LWP useragent curl post request to useragent request
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 | |
by smarthacker67 (Beadle) on May 26, 2018 at 21:31 UTC |