User guide

Web Services REST Examples Web Services, CLI Scripting, and OpenFlow
page 10-14 OmniSwitch AOS Release 8 Switch Management Guide May 2014
CLI Example
The following REST example return the output of the ‘show vlan’ command using the CLI.
Example Success Response
Example Error Response
Domain cli
URN aos
Verb GET
REST URL GET https://192.168.1.1/cli/aos?&cmd=show+vlan+5
JSON XML
{"result":{
"domain":"cli","cmd":"show
vlan 1",
"diag":200,
"output":"Name :
VLAN-1,\nType :
Static Vlan,\nAdministrative
State : enabled,\nOperational
State : enabled,\nIP Router
P o r t : e n a b l e d , \ n I P M T U
: 1500\n",
"error":"
","data":[]}}
<?xml version="1.0" encoding="UTF-8" ?>
<nodes>
<result><domain>cli</domain>
<cmd>show vlan 5</cmd>
<diag>200</diag>
<output>Name : VLAN-5,
Type : Static Vlan,
Administrative State : enabled,
Operational State : enabled,
IP Router Port : enabled,
IP MTU : 1500
</output>
<error></error>
<data></data>
</result>
</nodes>
JSON XML
{"result":{
"domain":"show vlan 5",
"diag":400,
"output":"",
"error":": VLAN 342 does not
exist\n",
"data":[]}}
<?xml version="1.0" encoding="UTF-8" ?>
<nodes>
<result><domain>mib:vlanTable</domain>
<diag>400</diag>
<output></output>
<error><node name="0">Submission failed : VLAN 5 does not exist</
node>
</error>
<data></data>
</result>
</nodes>