07-19-2017 08:35 AM
hi,
I am attempting 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
My question is how do I interrogate one of the 'normal' interfaces, I 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 as I am sure I will run into that those the future
Thanks
Paul
Solved! Go to Solution.
07-19-2017 08:42 AM
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"
Adam
07-19-2017 08:42 AM
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"
Adam
07-19-2017 08:53 AM
Thanks Adam,
The quoted version did not work for my but the %2F did.
I will bear both in mind for the future
07-19-2017 08:55 AM
no, %2F will not work today. It will be in the RFC compliant version of RESTCONF
07-19-2017 09:02 AM
Interesting...
when I use Postman to talk to my 3650 (running 16.5.1) I use...
Accept of application/vnd.yang.data+json
Conent-Type of application/vnd.yang.data+json
Basic-Auth
and when I try...
/restconf/api/running/interfaces/interface/GigabitEthernet"1/1/1"
I receive an error, but when I try
/restconf/api/running/interfaces/interface/GigabitEthernet1%2F1%2F1
I get the interface output
Am I missing something or doing something wrong?
07-19-2017 09:10 AM
Yes.. (sorry I 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.
Adam
07-19-2017 09:16 AM
Yes, the command is hidden but there , I want to get ahead the game I can!
You referenced the models, where is the best place to look at them to find out specific syntax just like you have pointed out
I am trying to get some scripts done and would ideally like to cover the majority of Cisco devices so that the operator can just supply a file with relevant information, e.g. device type
Any advice/links would be much appreciated (I am working my way through your NETCONF/YANG )
07-19-2017 09:25 AM
I did not want to do a RESTCONF one until it was officially shipping.
You might have convinced me too..
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