09-28-2020 04:21 PM
Hey all, I'm having this issue with making REST GET calls. When I make a call in Postman or Python to this device, it works fine:
https://host/restconf/data/ietf-interfaces:interfaces/
{ "name": "FiveGigabitEthernet1/0/1", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": {}, "ietf-ip:ipv6": {} }, { "name": "FiveGigabitEthernet1/0/10", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": {}, "ietf-ip:ipv6": {} }, ... ... { "name": "Vlan219", "type": "iana-if-type:l3ipvlan", "enabled": true, "ietf-ip:ipv4": { "address": [ { "ip": "10.46.219.60", "netmask": "255.255.255.128" } ] },When I modify the REST URI to focus on a specific VLAN interface, it works fine too:
{ "ietf-interfaces:interface": { "name": "Vlan219", "type": "iana-if-type:l3ipvlan", "enabled": true, "ietf-ip:ipv4": { "address": [ { "ip": "10.46.219.60", "netmask": "255.255.255.128" } ] }, "ietf-ip:ipv6": {} } }However, if I want to make a GET call to a specific physical interface, it doesn't work for some reason:
{ "errors": { "error": [ { "error-message": "uri keypath not found", "error-tag": "invalid-value", "error-type": "application" } ] } }The URI is calling the very first Fi1/0/1 interface that you saw in the very top output. Am I calling the interface incorrectly trying to get its output? What am I doing wrong here?
Solved! Go to Solution.
09-30-2020 12:45 PM
Ok figured it out. You have to replace forward-slashes in a call "/" with "%2F", which is needed for URL encoding and is an ASCII character reference. Here is the final correct call:
https://host/restconf/data/ietf-interfaces:interfaces/interface="FiveGigabitEthernet1%2F0%2F10"
{ "ietf-interfaces:interface": { "name": "FiveGigabitEthernet1/0/10", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": {}, "ietf-ip:ipv6": {} } }
09-28-2020 04:22 PM
Forgot to add, I'm running this on a Cisco 9300 on 16.9.5 code.
09-30-2020 09:30 AM
Just wanted to bump this and see if anyone had insights?
09-30-2020 12:45 PM
Ok figured it out. You have to replace forward-slashes in a call "/" with "%2F", which is needed for URL encoding and is an ASCII character reference. Here is the final correct call:
https://host/restconf/data/ietf-interfaces:interfaces/interface="FiveGigabitEthernet1%2F0%2F10"
{ "ietf-interfaces:interface": { "name": "FiveGigabitEthernet1/0/10", "type": "iana-if-type:ethernetCsmacd", "enabled": true, "ietf-ip:ipv4": {}, "ietf-ip:ipv6": {} } }
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