Accessing Aeries API using Perl REST::Client

33 views
Skip to first unread message

Sean Thomas

unread,
Sep 30, 2020, 12:29:54 PM9/30/20
to Interfacing With Aeries
Has anyone tried connecting to this API using Perl?

I gave it  shot, but I seem to be missing some key elements...

I keep getting a non-descript failure when I attempt to add the header.

AeriesHelloWorld.pl:
#!C:\Perl64\bin

use 5.18.0;
use warnings;
use REST::Client;
use IO::File;
use File::stat;
use File::Basename;
use File::Copy;

my $client = REST::Client->new();
$client->setHost('https://demo.aeries.net/aeries')
or error( "root:  Error setting REST host... $!" );

say "After setting REST Host...";

$client->addHeader('AERIES-CERT', '477abe9e7d27439681d62f4e0de1f5e1')
or error( "root:  Error adding REST header... $!" );

say "After adding header AERIES-CERT...";

# error( string ) display error message and quit
sub error
{
my $e = shift @_ || 'unknown error';  # <== assign first argument to $e... if no arguments, assign 'unknown error' to $e
say "$0: $e";
exit 0;
}

Reply all
Reply to author
Forward
0 new messages