diff --git a/xCAT-server/xCAT-wsapi/xcatws-test.pl b/xCAT-server/xCAT-wsapi/xcatws-test.pl index 927254f95..2cd22fb86 100755 --- a/xCAT-server/xCAT-wsapi/xcatws-test.pl +++ b/xCAT-server/xCAT-wsapi/xcatws-test.pl @@ -78,18 +78,20 @@ if (!$::URL) { my @updatearray; my $fieldname; my $fieldvalue; +my %entryhash; if (scalar(@ARGV) > 0){ foreach my $tempstr (@ARGV){ - push @updatearray, $tempstr; + push @updatearray, split(/=/,$tempstr); } } +%entryhash=@updatearray; my $request; my $ua = LWP::UserAgent->new(); my $response; if (($::METHOD eq 'PUT') || ($::METHOD eq 'POST')){ - my $tempstr = encode_json \@updatearray; + my $tempstr = encode_json \%entryhash; $request = HTTP::Request->new($::METHOD => $::URL); $request->header('content-type' => 'text/plain'); $request->header('content-length' => length($tempstr)); diff --git a/xCAT-server/xCAT-wsapi/xcatws-test.sh b/xCAT-server/xCAT-wsapi/xcatws-test.sh index b18edf98e..701370a66 100755 --- a/xCAT-server/xCAT-wsapi/xcatws-test.sh +++ b/xCAT-server/xCAT-wsapi/xcatws-test.sh @@ -10,7 +10,9 @@ pw=$2 format='format=json&pretty=1' #todo: add a test case for every api call that is documented -#todo: figure out why i currently have to specify -k +#curl [options] [URL...]: +# -X/--request : commands include PUT,POST,GET and DELETE. +# -k/--insecure : This option explicitly allows curl to perform "insecure" SSL connections and transfers. curl -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&format=xml" curl -X GET -k "https://127.0.0.1/xcatws/nodes?userName=$user&password=$pw&format=xml&field=mac"