5.0 APPENDIX E Perl Examples

WAS THIS PAGE HELPFUL? Leave Feedback

5.0 APPENDIX E Perl Examples

Appendix E: Contents

5.1 Query Services
#!/usr/bin/perl
use REST::Client;
use MIME::Base64;
use JSON;
#The basic use case
my $client = REST::Client->new();
$client->addHeader("Authorization", "Basic " . encode_base64("wsuser:wsuser"));
$client->addHeader("Accept", "application/json");
# $client->addHeader("Accept", "application/xml");
my $queryData = {
'query' => 'lastCheckTime is not null and appType = \'VEMA\' order by lastCheckTime',
'count' => '1'
};
my $params = $client->buildQuery( $queryData );
$client->GET('http://localhost/api/services' . $params);
my $response = decode_json($client->responseContent());
print $client->responseContent() . "\n";
my $service = $response->{'services'}->[0];
print "lastPlugInOutput: $service->{'lastPlugInOutput'}\n";
print "LastPluginOutput: $service->{'properties'}->{'LastPluginOutput'}\n";

Labels

restful restful Delete
rest rest Delete
api api Delete
perl perl Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.