Want to interrogate some interfaces on a Cisco 3650 switch using RESTCONF. If the interface has no forward slashes then its easy...
http://x.x.x.x/restconf/api/running/interfaces/interface/Vlan10?deep
However, the majority of the interfaces are not like that, e.g. GigabitEthernet1/0/1
How to interrogate one of the 'normal' interfaces, have tried many things but all end with the...
{
"errors": {
"error": [
{
"error-message": "invalid path",
"error-tag": "unknown-element"
}
]
}
}
error.
In addition to the forward slash, is there a document/link talking about special characters.
Today you can do it as:
/restconf/api/config/native/interface/GigabitEthernet/"1/0/1"
In the future it will be escaped as per standard behaviour
"GigabitEthernet1%2F0%2F1"
%2F will not work today (native models). It will be in the RFC compliant version of RESTCONF
While using Postman to talk to my 3650 (running 16.5.1) used...
Accept of application/vnd.yang.data+json
Conent-Type of application/vnd.yang.data+json
Basic-Auth
and when tried..
/restconf/api/running/interfaces/interface/GigabitEthernet"1/1/1"
receives an error, but when tried
/restconf/api/running/interfaces/interface/GigabitEthernet1%2F1%2F1
Got the interface output
Yes.. (Should have looked more closely at the request, to see it was IETF model)
that is the difference between the IETF and native models.
IETF has interface name with "/" in it as the key is the full interface name e.g. "GigabitEthernet1/0/1"
The native (IOS-XE) model has "GigabitEthernet" as a container and "1/0/1" as the key.
/restconf/api/running/interfaces/interface/GigabitEthernet1%2F1%2F1
vs
/restconf/api/config/native/interface/GigabitEthernet/"1/0/1"
We are in the process of transitioning to RFC-8040, and %2F. Older versions of code will work differently. We do not "officially" support RESTCONF yet, so still a bit of flux.
Comments
0 comments
Please sign in to leave a comment.