use strict;
use warnings;
use OvhApi;
+use URI::Escape qw(uri_escape);
use JSON;
#################################################################################
#
my $VERBOSE = $main::VERBOSE = 1;
my $DEBUG = $main::DEBUG = 0;
-my %Opt; get_options(\%Opt);
+my %Opt = (
+ 'method' => 'GET',
+);
+get_options(\%Opt);
help() unless @ARGV;
$main::_DATA_ = undef;
#################################################################################
#use Data::Dumper;
my @KEY = split(":",shift @ARGV);
-my $URL = shift @ARGV;
-my $METHOD = @ARGV ? shift(@ARGV) : 'GET';
+my $URL = @ARGV == 1 ? shift @ARGV : join('/',map{uri_escape($_)} @ARGV);
# Auth
if (@KEY==1) {
my $o = OvhApi->new(type => OvhApi::OVH_API_EU, applicationKey => $KEY[0], applicationSecret => $KEY[1], consumerKey => $KEY[2]);
-my $response = $o->get(path=>$URL,method=>$METHOD);
+my $response = $o->get(path=>$URL,method=>$Opt{method});
if (!$response) {
die "$NAME: $URL failed!"
=head1 OPTIONS
+ option[method|m] Method (default: GET)
option[verbose|v+] Verbose mode: increase the verbosity level.
option[debug+] Debug mode: increase the verbosity level.
option[version|V] Print version (default: $VERSION)