[pve-devel] r6055 - pve-manager/pve2/bin/test

svn-commits at proxmox.com svn-commits at proxmox.com
Tue May 31 08:17:03 CEST 2011


Author: dietmar
Date: 2011-05-31 08:17:03 +0200 (Tue, 31 May 2011)
New Revision: 6055

Added:
   pve-manager/pve2/bin/test/example2.pl
Log:
add example


Added: pve-manager/pve2/bin/test/example2.pl
===================================================================
--- pve-manager/pve2/bin/test/example2.pl	                        (rev 0)
+++ pve-manager/pve2/bin/test/example2.pl	2011-05-31 06:17:03 UTC (rev 6055)
@@ -0,0 +1,25 @@
+#!/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/access/domains", {});
+print "TEST: " . Dumper($res);


Property changes on: pve-manager/pve2/bin/test/example2.pl
___________________________________________________________________
Added: svn:executable
   + *




More information about the pve-devel mailing list