http://qs1969.pair.com?node_id=11146046

jeanbaptiste93 has asked for the wisdom of the Perl Monks concerning the following question:

Hi, all!

I am trying to call a particular API endpoint and am being unsuccessful. I have been able to make calls to dozens of endpoints to the same API, so I was unsure as to what the issue was. I tried a cURL with the relevant params and it worked successfully. But I am being unable to replicate it to HTTP::Request.

Here's the cURL:

curl --request PUT --url 'https://[URL]/[ENDPOINT]/item?key=[KEY]&token=[TOKEN]' --header 'Content-Type: application/json' --data '{"value": {"text": "38"}}'

I have tried:

my $browser = LWP::UserAgent::JSON->new(); my $response = $browser->put( $url, Content => to_json($data) );

and:

my $request = HTTP::Request::JSON->new( 'PUT', $url, [ Accept => 'application/json', 'Content-Type' => 'application/json', ], to_json($data) ); my $browser = LWP::UserAgent::JSON->new(); my $response = $browser->request($request);

and similar solutions to no avail. I appreciate any help!