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

Re: How to pass credentials through REST::Client

by jimpudar (Pilgrim)
on Apr 07, 2018 at 03:57 UTC ( [id://1212476]=note: print w/replies, xml ) Need Help??


in reply to How to pass credentials through REST::Client

Hi Thanos,

I know your question was already answered, but I thought I would suggest you take a look at https://metacpan.org/pod/Mojo::UserAgent.

The entire Mojolicious project is excellent and worth taking a look.

It's very easy to create REST services with Mojolicious, but the UserAgent is also fantastic and a pleasure to work with.

For example, here are a couple of requests with different auth types. These examples are from the page I linked.

# Quick JSON API request with Basic authentication my $value = $ua->get('https://sri:t3st@example.com/test.json')->result +->json; # JSON POST (application/json) with TLS certificate authentication my $tx = $ua->cert('tls.crt')->key('tls.key') ->post('https://example.com' => json => {top => 'secret'});

Best,

Jim

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-24 09:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found