pve-manager/bin/test/example1.pl
2011-08-23 07:40:22 +02:00

27 lines
534 B
Perl
Executable File

#!/usr/bin/perl -w
use strict;
use PVE::API2Client;
use PVE::AccessControl;
use PVE::INotify;
use Data::Dumper;
my $hostname = PVE::INotify::read_file("hostname");
# normally you use username/password,
# but we can simply create a ticket if we are root
my $ticket = PVE::AccessControl::assemble_ticket('root');
my $conn = PVE::API2Client->new(
# username => 'root',
# password => 'yourpassword',
ticket => $ticket,
host => $hostname,
);
my $res = $conn->get("api2/json/", {});
print "TEST: " . Dumper($res);