show inventory

show inventory

import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
  "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show inventory ",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)


{

    "ins_api": {
        "outputs": {
            "output": {
                "body": {
                    "TABLE_inv": {
                        "ROW_inv": [
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis\"", 
                                "name": "\"Chassis\"", 
                                "productid": "N3K-C3548P-10GX", 
                                "serialnum": "FOC1847R05N", 
                                "vendorid": "V00"
                            }, 
                            {
                                "desc": "\"48x10GE Supervisor\"", 
                                "name": "\"Slot 1\"", 
                                "productid": "N3K-C3548P-10GX", 
                                "serialnum": "FOC18501B5S", 
                                "vendorid": "V00"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Power Supply\"", 
                                "name": "\"Power Supply 1\"", 
                                "productid": "N2200-PAC-400W", 
                                "serialnum": "DTN1847P1LT", 
                                "vendorid": "V05"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Power Supply\"", 
                                "name": "\"Power Supply 2\"", 
                                "productid": "N2200-PAC-400W", 
                                "serialnum": "DTN1847P1MG", 
                                "vendorid": "V05"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Fan Module\"", 
                                "name": "\"Fan 1\"", 
                                "productid": "NXA-FAN-30CFM-F", 
                                "serialnum": "N/A", 
                                "vendorid": "V00"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Fan Module\"", 
                                "name": "\"Fan 2\"", 
                                "productid": "NXA-FAN-30CFM-F", 
                                "serialnum": "N/A", 
                                "vendorid": "V00"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Fan Module\"", 
                                "name": "\"Fan 3\"", 
                                "productid": "NXA-FAN-30CFM-F", 
                                "serialnum": "N/A", 
                                "vendorid": "V00"
                            }, 
                            {
                                "desc": "\"Nexus3500 C3548P-10GX Chassis Fan Module\"", 
                                "name": "\"Fan 4\"", 
                                "productid": "NXA-FAN-30CFM-F", 
                                "serialnum": "N/A", 
                                "vendorid": "V00"
                            }
                        ]
                    }
                }, 
                "code": "200", 
                "input": "show inventory ", 
                "msg": "Success"
            }
        }, 
        "sid": "eoc", 
        "type": "cli_show", 
        "version": "1.0"
    }
}

The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show inventory command, see the CLI command reference:

http//www.cisco.com/c/en/us/support/switches/nexus-3000-series-switches/products-command-reference-list.html

CLI Output
Switch# show inventory 
NAME: "Chassis",  DESCR: "Nexus3500 C3548P-10GX Chassis"
PID: N3K-C3548P-10GX , VID: V00 , SN: FOC1847R05N
NAME: "Slot 1", DESCR: "48x10GE Supervisor"
PID: N3K-C3548P-10GX , VID: V00 , SN: FOC18501B5S
NAME: "Power Supply 1", DESCR: "Nexus3500 C3548P-10GX Chassis Power Supply" PID: N2200-PAC-400W , VID: V05 , SN: DTN1847P1LT
NAME: "Power Supply 2", DESCR: "Nexus3500 C3548P-10GX Chassis Power Supply" PID: N2200-PAC-400W , VID: V05 , SN: DTN1847P1MG
NAME: "Fan 1", DESCR: "Nexus3500 C3548P-10GX Chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V00 , SN: N/A
NAME: "Fan 2", DESCR: "Nexus3500 C3548P-10GX Chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V00 , SN: N/A
NAME: "Fan 3", DESCR: "Nexus3500 C3548P-10GX Chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V00 , SN: N/A
NAME: "Fan 4", DESCR: "Nexus3500 C3548P-10GX Chassis Fan Module" PID: NXA-FAN-30CFM-F , VID: V00 , SN: N/A