12-10-2020 11:43 PM
Hello,
When trying to configure CAT9K switch interface via RESTCONF, getting device refused one or more commands error, provided below the tried steps.
Used POSTMAN tool.
Get the individual interface details.
GET https://192.168.43.2/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F14
GET response.
{ "Cisco-IOS-XE-native:GigabitEthernet": { "name": "1/0/14" } }
{ "Cisco-IOS-XE-native:GigabitEthernet": { "name": "1/0/14", "ip": { "address": { "primary": { "address": "87.1.1.10", "mask": "255.255.255.0" } } } } }PUT Response
{ "errors": { "error": [ { "error-message": "inconsistent value: Device refused one or more commands", "error-path": "/Cisco-IOS-XE-native:native/interface/GigabitEthernet=\"1/0/14\"", "error-tag": "invalid-value", "error-type": "application" } ] }
{ "Cisco-IOS-XE-native:GigabitEthernet": { "name": "1/0/14", "ip": { "address": { "primary": { "address": "87.1.1.10", "mask": "255.255.255.0" } } } } }PATCH Response
{ "errors": { "error": [ { "error-message": "inconsistent value: Device refused one or more commands", "error-path": "/Cisco-IOS-XE-native:native/interface/GigabitEthernet", "error-tag": "invalid-value", "error-type": "application" } ] } }
12-13-2020 01:46 PM
Hi Mohan
For PUT or PATCH commands, when some raw JSON attributed, try this command:
{ "Cisco-IOS-XE-native:GigabitEthernet": { "name": "1/0/14", "ip": { "address": { "primary": { "address": "87.1.1.10", "mask": "255.255.255.0" } } } } }
05-30-2022 06:40 PM
Greeting Yan,
I had to say sorry,
It is working by run PUT use the upper tier of the API, amazing!
THANKS FOR YOUR SHARE!!!
MANY THANKS!
All the best
Yao, Eric
05-29-2022 07:58 PM
05-31-2022 09:42 AM - edited 06-02-2022 09:12 AM
I believe you are missing top level containers in your payload. There should be something like this:
{
"Cisco-IOS-XE-native:native": {
"line": {
"vty": [
{
"first": 0,
"last": 4,
"transport": {
"input": {
"input": [
"telnet"
]
}
}
},
{
"first": 5,
"last": 6,
"transport": {
"input": {
"input": [
"none"
]
}
}
}
]
}
}
}
Yan
06-06-2022 01:58 AM
Thanks very much! All done.
Yao
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide