show version
Python
Copy
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 version            ",
  "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": {
    "type": "cli_show",
    "version": "1.0",
    "sid": "eoc",
    "outputs": {
      "output": {
        "input": "show version",
        "msg": "Success",
        "code": "200",
        "body": {
          "header_str": "Cisco Nexus Operating System (NX-OS) Software\nTAC support: http://www.cisco.com/tac\nCopyright (C) 2002-2018, Cisco and/or its affiliates.\nAll rights reserved.\nThe copyrights to certain works contained in this software are\nowned by other third parties and used and distributed under their own\nlicenses, such as open source.  This software is provided \"as is,\" and unless\notherwise stated, there is no warranty, express or implied, including but not\nlimited to warranties of merchantability and fitness for a particular purpose.\nCertain components of this software are licensed under\nthe GNU General Public License (GPL) version 2.0 or \nGNU General Public License (GPL) version 3.0  or the GNU\nLesser General Public License (LGPL) Version 2.1 or \nLesser General Public License (LGPL) Version 2.0. \nA copy of each such license is available at\nhttp://www.opensource.org/licenses/gpl-2.0.php and\nhttp://opensource.org/licenses/gpl-3.0.html and\nhttp://www.opensource.org/licenses/lgpl-2.1.php and\nhttp://www.gnu.org/licenses/old-licenses/library.txt.\n",
          "bios_ver_str": "07.64",
          "kickstart_ver_str": "9.2(2) [build 9.2(1.47)]",
          "bios_cmpl_time": "05/16/2018",
          "kick_file_name": "bootflash:///nxos.9.2.1.47.bin",
          "kick_cmpl_time": "8/4/2018 19:00:00",
          "kick_tmstmp": "08/05/2018 03:07:21",
          "chassis_id": "Nexus9000 C9396PX Chassis",
          "cpu_name": "Intel(R) Core(TM) i3- CPU @ 2.50GHz",
          "memory": 16400292,
          "mem_type": "kB",
          "proc_board_id": "SAL1932LNKJ",
          "host_name": "9396px",
          "bootflash_size": 51496280,
          "kern_uptm_days": 0,
          "kern_uptm_hrs": 20,
          "kern_uptm_mins": 36,
          "kern_uptm_secs": 2,
          "rr_usecs": 897986,
          "rr_ctime": "Wed Aug  8 00:10:51 2018",
          "rr_reason": "Reset Requested by CLI command reload",
          "rr_sys_ver": "9.2(1)",
          "rr_service": "",
          "manufacturer": "Cisco Systems, Inc.",
          "TABLE_package_list": {
            "ROW_package_list": {
              "package_id": {}
            }
          }
        }
      }
    }
  }
}