my $cookies = HTTP::Cookies->new(); my $ua = LWP::UserAgent->new( cookie_jar => {} ); $req -> authorization_basic ( 'cloud-bespoke' ); my $rc = REST::Client->new( { useragent => $ua } ); my $headers = {Content-type => 'application/json'}; my $client = REST::Client->new( { useragent => $ua }); my $res = $client->POST('URL', '{"username": "username, "password":"password"}', {"Content-type" => 'application/json'}); chkerr($client->responseCode()); print $client->responseContent(); print "\n" . $cookies->as_string;