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 ]
|