DescriptionNX-API Response Element
Session ID of the response. This element is valid only when the response message is
chunked.
sid
Tag that encloses all command outputs.
When multiple commands are in cli_show or cli_show_ascii, each command output is
enclosed by a single output tag.
When the message type is cli_conf or bash, there is a single output tag for all the
commands because cli_conf and bash commands require context.
outputs
Tag that encloses the output of a single command output.
For cli_conf and bash message types, this element contains the outputs of all the
commands.
output
Tag that encloses a single command that was specified in the request. This element
helps associate a request input element with the appropriate response output element.
input
Body of the command response.body
Error code returned from the command execution.
NX-API uses standard HTTP error codes as described by the Hypertext Transfer Protocol
(HTTP) Status Code Registry
(http://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml).
code
Error message associated with the returned error code.msg
Command Types
There are a number of command “types” available for sending show and configuration commands to a device using the NX-API. The
type you need to use depends on the actual command you want to send: cli_show: You should use the “cli_show” type when you
want to send a show command that supports structured XML output. To know whether a command supports XML output or not, you
can go to the CLI of the switch and run the command with the "| xml" option on the end—you will be able to see whether that command
returns XML output or not. If you try and use the "cli_show" command type with a command that does not support XML, you will
receive a message stating “structured output unsupported” from the API:
<?xml version="1.0" encoding="UTF-8"?>
<ins_api>
<type>cli_show</type>
<version>0.1</version>
<sid>eoc</sid>
<outputs>
<output>
<input>show clock</input>
<msg>Structured output unsupported</msg>
<code>501</code>
</output>
</outputs>
</ins_api>
If that happens, you will need to use the command type— "cli_show_ascii".
9