
Using the XML API
17
Scripting guidelines
When scripting command input, use CLI syntax as defined in this guide. For use with Telnet or SSH, use a
space character between command names, parameters, and their values (as shown throughout this guide).
For use with the HTTP interface, use a ’/’ character instead of a space character between command
names, parameters, and their values.
When writing scripts to parse XML API output, use an XML library to parse the data. For parsing, a script
should
not
rely on ordering, spacing, or column position. To find a specific property, a script should
compare property names as it searches through the data. This allows the script to be compatible with future
versions that could potentially add new fields to the output.
The output of
show
commands is intended for monitoring or obtaining the current configuration. Other
commands provide configuration data and display one or more status objects that specify the status of
command processing. The last status object specifies the overall status of the command; other status objects
indicate intermediate processing status.
The following example shows the XML API status object:
<OBJECT basetype="status" name="status" oid="1">
<PROPERTY name="response-type" type="string" size="12" draw="false"
sort="nosort" display-name="Response Type">Success</PROPERTY>
<PROPERTY name="response-type-numeric" type="uint32" size="12" draw="false"
sort="nosort" display-name="Response Type">0</PROPERTY>
<PROPERTY name="response" type="string" size="180" draw="true" sort="nosort"
display-name="Response">Command completed successfully. (2014-07-10
13:52</PROPERTY>
<PROPERTY name="return-code" type="sint32" size="15" draw="false"
sort="nosort" display-name="Return Code">0</PROPERTY>
<PROPERTY name="component-id" type="string" size="80" draw="false"
sort="nosort" display-name="Component ID"></PROPERTY>
<PROPERTY name="time-stamp" type="string" size="25" draw="false"
sort="datetime" display-name="Time">2014-07-10 13:52:45</PROPERTY>
<PROPERTY name="time-stamp-numeric" type="uint32" size="25" draw="false"
sort="datetime" display-name="Time">1405000365</PROPERTY>
</OBJECT>
In a script, each command should check the previous command’s status before proceeding. If the value of
the
status
object’s
return-code
property is
0
, the command succeeded; any other value means that
the command failed.
XML API examples
The following example shows a command formatted for use with the command-line interface and for use
with the HTTPS interface, and its XML API output.
•
Command-line interface format:
create user JSmith interfaces wbi password Abc#1379
•
HTTP interface format:
create/user/JSmith/interfaces/wbi/password/Abc#1379
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RESPONSE VERSION="L100">
<OBJECT basetype="status" name="status" oid="1">
<PROPERTY name="response-type" type="string" size="12" draw="false"
sort="nosort" display-name="Response Type">Success</PROPERTY>
<PROPERTY name="response-type-numeric" type="uint32" size="12" draw="false"
sort="nosort" display-name="Response Type">0</PROPERTY>
<PROPERTY name="response" type="string" size="180" draw="true" sort="nosort"
display-name="Response">Command completed successfully. (JSmith) - The new user
was created. (2014-07-10 14:16:29)</PRO
PERTY>
<PROPERTY name="return-code" type="sint32" size="15" draw="false"
sort="nosort" display-name="Return Code">0</PROPERTY>
<PROPERTY name="component-id" type="string" size="80" draw="false"
sort="nosort" display-name="Component ID">JSmith</PROPERTY>
<PROPERTY name="time-stamp" type="string" size="25" draw="false"
sort="datetime" display-name="Time">2014-07-10 14:16:29</PROPERTY>
Содержание AssuredSAN 6004
Страница 11: ...Document conventions and symbols 11 TIP Provides helpful hints and shortcuts...
Страница 58: ...58 Alphabetical list of commands exit Description Log off and exit the CLI session Min role monitor Syntax exit...
Страница 107: ...set led 107 Identify drawer 1 in enclosure 1 set led drawer 1 1 on Identify fan 1 in enclosure 1 set led fan 1 1 on...
Страница 114: ...114 Alphabetical list of commands See also set cli parameters show protocols...
Страница 139: ...show controller statistics 139 See also reset all statistics reset controller statistics...
Страница 153: ...show disk statistics 153 See also reset all statistics reset disk error statistics reset disk statistics show disks...
Страница 162: ...162 Alphabetical list of commands See also show power supplies...
Страница 207: ...show volume reservations 207 Basetypes volume reservations status See also release volume show volumes...