Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: POST file through REST::Client

by poj (Monsignor)
on Apr 11, 2018 at 11:20 UTC ( #1212676=note: print w/replies, xml ) Need Help??


in reply to Re: POST file through REST::Client
in thread POST file through REST::Client [SOLVED]

You can use that solution in your module

sub postSnippetsFile { my ( $self, %options ) = @_; my $request = HTTP::Request::Common::POST( '', 'Content_Type' => 'form-data', 'Content' => [ file => [ $options{file} ] ], ); $request->authorization_basic($options{username},$options{password +}); #print Dumper $request; my $headers = { 'Content-Type' => $request->header('Content-Type'), "Authorization" => $request->header('Authorization'), }; my $body_content = $request->content; #print Dumper $headers,$body_content; $self->{_client}->POST( $options{url}, $body_content ,$headers ); #print $self->{_client}->responseCode(); return $self->{_client}->responseContent(); }
poj

Replies are listed 'Best First'.
Re^3: POST file through REST::Client
by thanos1983 (Vicar) on Apr 11, 2018 at 13:33 UTC

    Hello poj,

    Thanks a lot for your time and effort. It works as expected.

    BR / Thanos

    Seeking for Perl wisdom...on the process of learning...not there...yet!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1212676]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2018-07-17 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (354 votes). Check out past polls.

    Notices?