Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: POST file through REST::Client

by poj (Abbot)
on Apr 11, 2018 at 11:20 UTC ( [id://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 (Parson) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212676]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-04-25 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found