Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

POST file through REST::Client [SOLVED]

by thanos1983 (Parson)
on Apr 10, 2018 at 11:08 UTC ( [id://1212636]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    use strict;
    ...
    $ perl restClient.pl
    $VAR1 = 'Not a SCALAR reference at /usr/local/share/perl/5.22.1/LWP/Pr
    +otocol/http.pm line 260.
    ';
    
  2. or download this
    package ClientRest;
    
    ...
    }
    
    1;
    
  3. or download this
    $ curl -u user:password -H "Content-Type: multipart/form-data" -H "Acc
    +ept: application/json" -H "Expect:" -F file=@test.txt -X POST http://
    +127.0.0.1:8000/upload/ | jq '.'
      % Total    % Received % Xferd  Average Speed   Time    Time     Time
    +  Current
    ...
      "language": "perl",
      "style": "emacs"
    }
    
  4. or download this
    $ perl restClient.pl
    $VAR1 = 'Not a SCALAR reference at /usr/local/share/perl/5.22.1/LWP/Pr
    +otocol/http.pm line 260.
    ';
    
  5. or download this
    else {
        # Set (or override) Content-Length header
    ...
        hlist_remove(\@h, 'Content-Length');
        }
    }
    
  6. or download this
    my $headers = { "Content" => ['file' => [$options{file}]],
            "Content-type" => 'multipart/form-data',
            "Authorization" => 'Basic ' .
                encode_base64($options{username} . ':' . $options{password
    +}) };
    
  7. or download this
    # module part
    sub postSnippets {
    ...
              'url' => 'http://127.0.0.1:8000/snippets/2/',
              'owner' => 'user'
            };
    
  8. or download this
    $VAR1 = '{"detail":"Multipart form parse error - Invalid boundary in m
    +ultipart: None"}';
    
  9. or download this
    sub postSnippetsFile {
        my ( $self, %options ) = @_;
    ...
                    $headers );
        return $self->{_client}->responseContent();
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1212636]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found