in reply to REST::Client + Request Body
Here is an SSCCE which works perfectly for me using your provided "body" data.
#!/usr/bin/env perl use strict; use warnings; use REST::Client; my $rest = REST::Client->new ({ host => 'http://httpbin.org' }); my $body ='{ "includes" : [ { "ids" : ["fbb7c736-852f-4158-aae3-1f97bc755cec"], "observationName" : "sql_batches" } ], "startTime" : 1602043200000, "endTime" : 1602129599000, "granularity" : 86400000, "numberOfValue" : 1, "retrievalType" : "RAW" }'; my $headers = { Accept => 'application/json', 'Content-type' => 'application/json', }; $rest->POST ('/anything', $body, $headers); print $rest->responseContent;
You will see that I have quoted the Content-type key, perhaps you should too?
🦛
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: REST::Client + Request Body
by derby (Abbot) on Oct 13, 2020 at 11:35 UTC | |
Re^2: REST::Client + Request Body
by jcb (Parson) on Oct 14, 2020 at 01:15 UTC | |
Re^2: REST::Client + Request Body
by perlfan (Vicar) on Oct 13, 2020 at 15:39 UTC | |
by Anonymous Monk on Oct 13, 2020 at 19:15 UTC |
In Section
Seekers of Perl Wisdom