Using The Xml Api; Xml Api Elements - HP P2000 Reference Manual

Msa system
Hide thumbs Also See for P2000:
Table of Contents

Advertisement

}
}
print "Session Key = $sessionKey\n";
# Run a sample command to obtain the disks in the system.
$url = 'http://10.0.0.2/api/show/disks';
$req = HTTP::Request->new(GET => $url);
$req->header('sessionKey' => $sessionKey );
$req->header('dataType' => 'ipa' );
$res = $ua->request($req);
$url2 = 'http://10.0.0.2/api/exit';
$req2 = HTTP::Request->new(GET => $url3);
$req2->header('sessionKey' => $sessionKey );
$req2->header('dataType' => 'api' );
$res2 = $ua->request($req2);
print $res->content;
The next section provides more information about using the XML API.

Using the XML API

The Management Controller provides access for monitoring and management via the Telnet and SSH
protocols for command-line interface semantics, or via the HTTP and HTTPS protocols for XML API
request/response semantics.
You can use an XML parser, such as XML::Parser in Perl, to process the XML output and store this
information as objects. The XML parser should use the Document Type Definition (DTD) version that
corresponds to the firmware level to ensure that the XML is validated. The DTD provides the structure of all
content returned by the CLI when XML API format is enabled. By obtaining the latest DTD for validation, the
parser will be forward compatible. To obtain the DTD, go to http://hp.com/go/p2000.
The output of each CLI command is composed of valid XML data until the CLI prompt (typically #) is
encountered. The output contains a valid XML header followed by the XML elements described in the
following table.
Table 3

XML API elements

Element
Description and attributes
RESPONSE The RESPONSE element is the top-level element, which contains all data output for the CLI command
that was issued. The response includes:
There is only one RESPONSE element per issued command.
In general, an OBJECT element describes a storage-system component such as a disk or a volume. An
OBJECT
object has these attributes:
The OBJECT element can contain PROPERTY elements.
18
Using the CLI
$sessionKey = $prop->textContent;
A number of OBJECT elements, which varies by command.
A status object that provides a message and return code. A return code of 0 indicates that the
command succeeded. Any other return code is an error code.
basetype. This attribute allows output in brief mode to be correlated with metadata to reduce the
overhead of each command, as described in
to detect the type of the object (e.g., a disk, a volume, etc.).
name. The name of the object.
oid. The unique identifier for the object in the scope of the response.
XML API
optimization. This is also a good field to use

Advertisement

Table of Contents
loading

This manual is also suitable for:

P2000 g3

Table of Contents