]> git.proxmox.com Git - pve-apiclient.git/blobdiff - src/examples/example3.pl
separate packaging and source build system
[pve-apiclient.git] / src / examples / example3.pl
diff --git a/src/examples/example3.pl b/src/examples/example3.pl
new file mode 100755 (executable)
index 0000000..d09e052
--- /dev/null
@@ -0,0 +1,24 @@
+#!/usr/bin/perl
+
+# NOTE: you need to set the API token and PVE host below for this to work
+
+use strict;
+use warnings;
+
+use PVE::APIClient::LWP;
+
+use JSON;
+
+my $apitoken = 'PVEAPIToken=USER@REALM!TOKENID=TOKENVALUE';
+my $hostname = "127.0.0.1";
+
+my $conn = PVE::APIClient::LWP->new(
+    apitoken => $apitoken,
+    host => $hostname,
+    # allow manual fingerprint verification
+    manual_verification => 1,
+    );
+
+my $res = $conn->get("/access/permissions", {});
+
+print to_json($res, { pretty => 1, canonical => 1});