requests, another session cookie is required and is provided by the authentication process. Avoiding unnecessary use of the authentication
process helps to reduce the workload on the device.
Note
A nxapi_auth cookie expires in 600 seconds (10 minutes). This value is a fixed and cannot be adjusted.
NX-API performs authentication through a programmable authentication module (PAM) on the switch.
Note
Use cookies to reduce the number of PAM authentications, which reduces the load on the PAM.
Using NX-API
The commands, command type, and output type for the Cisco Nexus 5000 and 6000 Series devices are entered using NX-API by
encoding the CLIs into the body of a HTTP/HTTPs POST. The response to the request is returned in XML or JSON output format.
You must enable NX-API with the feature manager CLI command on the device. By default, NX-API is disabled.
The following example shows how to enable NX-API:
• Enable the management interface.
switch# configure terminal
switch(config)# interface mgmt 0
switch(config)# ip address 198.51.100.1/24
switch(config)# vrf context managment
switch(config)# ip route 203.0.113.1/0 1.2.3.1
• Enable the NX-API nxapi feature.
switch# configure terminal
switch(config)# feature nxapi
The following example shows a request and its response in XML format:
Request:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ins_api>
<version>0.1</version>
<type>cli_show</type>
<chunk>0</chunk>
<sid>session1</sid>
<input>show switchname</input>
<output_format>xml</output_format>
</ins_api>
Response:
<?xml version="1.0"?>
<ins_api>
<type>cli_show</type>
<version>0.1</version>
<sid>eoc</sid>
<outputs>
<output>
<body>
<hostname>switch</hostname>
</body>
<input>show switchname</input>
<msg>Success</msg>
<code>200</code>
</output>
3