cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1290
Views
0
Helpful
2
Replies

Query problem with POSTMAN and REST API (Catalyst 9200)

bbianco
Level 1
Level 1

I am relatively new to DEVNET and am working on setting up some automation.

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:

 

{
    "Cisco-IOS-XE-native:GigabitEthernet": [
        {
            "name""0/0",
            "vrf": {
                "forwarding""Mgmt-vrf"
            },
            "Cisco-IOS-XE-ethernet:negotiation": {
                "auto"true
            }
        },
        {
            "name""1/0/1",
            "description""ZYXW",
            "switchport": {
                "Cisco-IOS-XE-switch:mode": {
                    "trunk": {}
                },
                "Cisco-IOS-XE-switch:trunk": {
                    "allowed": {
                        "vlan": {
                            "vlans""4,6,13,22,24"
                        }
                    }
                }
            }
        },
        {
            "name""1/0/10"
        },

... 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:

{
    "errors": {
        "error": [
            {
                "error-message""uri keypath not found",
                "error-tag""invalid-value",
                "error-type""application"
            }
        ]
    }
}
 
 
I have tried using quotes, and a number of other tricks to no avail. Keep in mind the query works just fine when look at an individual Vlan interface.
 
https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/Vlan=13
 
{
    "Cisco-IOS-XE-native:Vlan": {
        "name"13,
        "description""Management",
        "ip": {
            "address": {
                "primary": {
                    "address""x.x.x.15",
                    "mask""255.255.255.0"
                }
            }
        }
    }
}

 

Any thoughts as to what I am doing wrong?

 

Thanks and Be Well

 

 

1 Accepted Solution

Accepted Solutions

Hello,

 

to query interface GigabitEthernet1/0/1, use the syntax below:


https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F1

View solution in original post

2 Replies 2

Hello,

 

to query interface GigabitEthernet1/0/1, use the syntax below:


https://x.x.x.15/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F1

Excellent.  Thanks for your quick response.  That was the fix!!!

Review Cisco Networking for a $25 gift card