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

request is missing required http header apikey

how can i add http header apikey in url post

my $http = HTTP::Tinyish->new(); my $res = $http->post("url", { headers => {'Content-Type' => 'application/json'}, Authorization => 'apikey jhtty657', content => #data, }

Replies are listed 'Best First'.
Re: http header
by huck (Prior) on May 07, 2017 at 23:20 UTC

    How did you add the Content-Type header?

    my $res = $http->post("url", { headers => {'Content-Type' => 'application/json' ,apikey=>' jhtty657' }, content => #data, } );

      thanks guys it was helpful worked

Re: http header
by nikosv (Deacon) on May 08, 2017 at 06:54 UTC
    Since HTTP::Tinyish is a wrapper over LWP, why not go with LWP directly?
    
    my $browser = LWP::UserAgent->new();
    
    my $header = HTTP::Headers->new(
                          Content_Type        => 'application/json',           
                          'api-key'=>"jhtty657");
                          #or maybe apikey=>"jhtty657" without the dash?
    
    $url="https://somewhere.com";
    
    
    $req = HTTP::Request->new( POST, $url, $header);
    $req->content($data);
    
    my $response=$browser->request($req);
    
    
    

      Maybe because it's not a wrapper around LWP. It's an HTTP class that chooses between several backend implementations, one of which is LWP. There's no guarantee that LWP is installed on the OP's machine.

        "This module can be useful in a restrictive environment where you need to be able to download CPAN modules without an HTTPS support in built-in HTTP library."

        Get a better job then. :) No really. :)

Re: http header
by Anonymous Monk on May 07, 2017 at 21:38 UTC

    how can i add http header apikey in url post

    Copy/paste from the documentation?

    HTTP::Tinyish looks good to me