09-15-2020 05:57 AM
Apologies If I have posted this to the wrong group.
I am relatively new to DEVNET and am working on setting up some automation for my enterprise.
Because of the switch environment it is essential for me to get configuration info for a specific port.
I have built a query:
"https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet"
and get the following response:
... etc. (the rest isn't important, let it suffice to say that I see every GigabitEthernet port.)
The documentation that I read say that if I build the query to read:
https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1/0/1
I should see just the 1/0/1 interface in the output. This does not happen, I get:
https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/Vlan=13
Any thoughts as to what I am doing wrong?
Thanks and Be Well
12-17-2020 05:20 AM
You have to take into account URL encoding. Replace the forward slashes in 1/0/1 with %2F, so that it reads 1%2F0%2F1. You will then get the output. This is why you get a result when using VLAN13, as there are no forward slashes in the request.
02-19-2021 06:39 AM
Great question (was also my problem) and even better answer; this works in bash (eg with curl) and in Python (eg with requests). All examples are always with simple interface names, even here at DevNet, but in my network most interface names are like 1/0/10. This looks trivial, but it can be a headbreaker ...
So this was indeed the solution. Thanks !
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