![]() |
Consumption Analytics Documentation |
The following example Perl script snippet fetches the resource information for the resource with headerId
10021.
#!/usr/local/bin/perl ‐w use LWP::UserAgent; $myurl = "http://localhost:8080/rest/v1/resources/resource/10021"; $ua = new LWP::UserAgent; $req = new HTTP::Request 'GET' => "$myurl"; $req‐>header('Accept' => 'application/xml'); #set the Basic Authentication header $req‐>authorization_basic('username', 'password'); #send request $res = $ua‐>request($req); #check the response if ($res‐>is_success) { print $res‐>content; } else { print "Error: " . $res‐>status_line . "\n"; #The server error message is in the response body print $res‐>content }
(c) Copyright 2017-2020 Hewlett Packard Enterprise Development LP