]> git.proxmox.com Git - pve-apiclient.git/blame - examples/example3.pl
implement api token support
[pve-apiclient.git] / examples / example3.pl
CommitLineData
7b6f8f1d
FG
1#!/usr/bin/perl
2
3# NOTE: you need to set the API token and PVE host below for this to work
4
5use strict;
6use warnings;
7
8use PVE::APIClient::LWP;
9
10use JSON;
11
12my $apitoken = 'PVEAPIToken=USER@REALM!TOKENID=TOKENVALUE';
13my $hostname = "127.0.0.1";
14
15my $conn = PVE::APIClient::LWP->new(
16 apitoken => $apitoken,
17 host => $hostname,
18 # allow manual fingerprint verification
19 manual_verification => 1,
20 );
21
22my $res = $conn->get("/access/permissions", {});
23
24print to_json($res, { pretty => 1, canonical => 1});