show hostname
show hostname
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 hostname",
"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 hostname",
"msg": "Success",
"code": "200",
"body": {
"hostname": "turin-1"
}
}
}
}
}
The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show hostname command, see the CLI command reference:
Note: This example was added in Cisco NX-OS Release 9.2(1).
CLI Output |
---|
|
show hosts
show hosts
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 hosts",
"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 hosts",
"msg": "Success",
"code": "200",
"body": {
"dnslookup": "DNS lookup enabled",
"dnsnameservice": "Name/address lookup uses domain service\nName servers are 255.255.255.255\n",
"TABLE_dnsconfigvrf": {
"ROW_dnsconfigvrf": [
{
"dnsvrfname": "default",
"usevrf": "management",
"token": "name-server(s)",
"TABLE_dnsconfigvrfconfig": {
"ROW_dnsconfigvrfconfig": {
"config": "1.1.1.1"
}
}
},
{
"dnsvrfname": "default",
"usevrf": "test",
"token": "name-server(s)",
"TABLE_dnsconfigvrfconfig": {
"ROW_dnsconfigvrfconfig": [
{
"config": "1::1"
},
{
"config": "1::2"
}
]
}
}
]
}
}
}
}
}
}
The CLI output example below corresponds to the payload example in the code pane on the right. For more information about the show hosts command, see the CLI command reference:
Note: This example was added in Cisco NX-OS Release 9.2(1).
CLI Output |
---|
|