cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9776
Views
10
Helpful
3
Replies

Rest API documentation for Catalyst 9000 switches

mario.jost
Level 3
Level 3

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.

3 Replies 3

Mark Elsen
Hall of Fame
Hall of Fame

 

  - Check if this guide can help you :

          https://www.cisco.com/c/en/us/td/docs/routers/csr1000/software/restapi/restapi.html

 M,



-- Let everything happen to you  
       Beauty and terror
      Just keep going    
       No feeling is final
Reiner Maria Rilke (1899)

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.

brownm5
Level 1
Level 1

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!