ptone has asked for the wisdom of the Perl Monks concerning the following question:
With the above, I am trying to help one of our customers to remotely sign into a Phone but I cannot parse the info. It must be something little but I am stuck. Could someone kindly help me out? I actually managed the same in Power Shell but I like to offer various examples to them. Best Regards Steffen##!/usr/bin/perl -l use strict; use warnings; use LWP::UserAgent; my $username = "Polycom"; my $password = "789"; my $phoneip = $ARGV[0]; my $user = $ARGV[1]; my $Address = $ARGV[2]; my $passcode = $ARGV[3]; my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 }, protocols_allowed => ['https'], ); my $URL = "https://$phoneip/api/v1/mgmt/skype/signIn"; { # Create the request object and add the authentication header and cont +ent my $req = HTTP::Request->new(POST => $URL); $req->content_type('application/json'); $req->authorization_basic( $username, $password ); $req->content('{"data":{"Address": "$Address","User": "$user","Passw +ord": "$passcode","Domain":"","LockCode":""}}'); # Send the request to the user agent and print the result my $response = $ua->request($req); print "\r\n"; print $response->decoded_content; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl REST API Post script
by hippo (Archbishop) on Feb 10, 2020 at 23:11 UTC | |
|
Re: PERL REST API Post script
by tangent (Parson) on Feb 10, 2020 at 21:51 UTC | |
|
Re: PERL REST API Post script
by haukex (Archbishop) on Feb 10, 2020 at 21:09 UTC | |
|
Re: PERL REST API Post script
by kcott (Archbishop) on Feb 11, 2020 at 07:44 UTC | |
|
Re: PERL REST API Post script
by Anonymous Monk on Feb 11, 2020 at 16:44 UTC | |
by haukex (Archbishop) on Feb 11, 2020 at 16:54 UTC |