cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4995
Views
4
Helpful
7
Replies

Interrogate IOS-XE interfaces with RESTCONF (with Postman)

PAUL MELVIN
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

aradford
Cisco Employee
Cisco Employee

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

View solution in original post

7 Replies 7

aradford
Cisco Employee
Cisco Employee

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

Thanks Adam,

The quoted version did not work for my but the %2F did.

I will bear both in mind for the future

no, %2F will not work today.  It will be in the RFC compliant version of RESTCONF

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?

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

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 )

I did not want to do a RESTCONF one until it was officially shipping.

You might have convinced me too..