11-05-2020 03:09 AM
I am looking for the official Rest API documentation to get the correct syntax to configure devices via PUT command.
I am looking for something like this API Explorer but for Cisco switches:
https://dropbox.github.io/dropbox-api-v2-explorer/#file_properties_properties/update
I do get some URLs while GETting configurations from my device (Catalyst 9200 switch), but all the URLs are 404:
<GigabitEthernet xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native" xmlns:ios="http://cisco.com/ns/yang/Cisco-IOS-XE-native"> <name>1/0/17</name> <description>dontmakestupidpeoplefamous</description> <switchport> <trunk xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-switch"> <native> <vlan>225</vlan> </native> </trunk> </switchport> <source> <template> <template-name> <template-name>LAN</template-name> </template-name> </template> </source> </GigabitEthernet>
I have already seen similar questions pop up multiple times, but in all of them, the answers seem to miss the topic. This is not a question what I want to configure in detail, or what tool I use to configure it. Thses questions are irrelevant. I just want to know where i can find the API Documentation / Browser / Explorer for these devices.
11-05-2020 03:32 AM
- Check if this guide can help you :
https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/restapi.html
M,
11-06-2020 12:36 AM - edited 11-06-2020 02:39 PM
This documentation is for CSR1000 routers (can even be seen in the URL) and the syntax looks very different from the ones on the catalyst switches. Example CSR:
curl -k https://router/api/v1/l2interfaces/GigabitEthernet2 -u "ad:min" curl -k http://router/api/v1/nat-svc/pool/marketing-nat-pool -u "ad:min"
Examples Catalyst:
curl -k https://switch/restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F2 -u "ad:min"
curl -k https://switch/restconf/data/Cisco-IOS-XE-native:native/snmp/ -u "ad:min"
If the documentation could be found by a simple google search, I woulnt have created this post.
12-07-2023 03:17 PM
I found a couple of links that might be helpful. First, this:https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/176/b_176_programmability_cg/m_176_prog_restconf.html
It wasn't very helpful to me, but it looks like there is some useful information there.
This one was much more helpful: https://www.postman.com/ciscodevnet/workspace/cisco-devnet-s-public-workspace/request/3224967-f0f72532-294f-4a0c-a54b-cbc2feca8a6f
It contains specific examples of API calls.
Hope you find this helpful.
Cheers!
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