Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How to pass credentials through REST::Client

by thanos1983 (Parson)
on Apr 06, 2018 at 09:36 UTC ( #1212413=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    package ClientRest;
    
    ...
    # Module further implementation here
    
    1;
    
  2. or download this
    #!/usr/bin/perl
    use strict;
    ...
                             }
                           ]
            };
    
  3. or download this
    $ curl -i -X POST -H "Content-Type:application/json" -u user:password 
    +http://localhost:8000/snippets/ -d '{
    >     "title": "Test Title",
    ...
    Allow: GET, POST, HEAD, OPTIONS
    
    {"url":"http://localhost:8000/snippets/2/","id":2,"highlight":"http://
    +localhost:8000/snippets/20/highlight/","owner":"user","title":"Test T
    +itle","code":"print \"Test POST Request\"","linenos":false,"language"
    +:"perl","style":"emacs"}
    
  4. or download this
    my $headers = {Accept => 'application/json', Authorization => 'Basic '
    + . encode_base64($username . ':' . $password)};
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1212413]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-11-30 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?