cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1221
Views
5
Helpful
2
Replies

aci rest api

gavinhans
Level 1
Level 1

how to navigate to aci-api? how to know all uri for rest api? is there easy way?

2 Replies 2

balaji.bandi
Hall of Fame
Hall of Fame

here is the good reference thread to start :

 

https://community.cisco.com/t5/application-centric/aci-rest-api-custom-reporting/m-p/4007785

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Claudia de Luna
Spotlight
Spotlight

Hi @gavinhans,

 

The link from @balaji.bandi is a great start.   What always helps me is to start with Postman (https://www.postman.com/downloads/) and just see if I can communicate with the API.

 

I'm attaching a screen shot of my Postman request to log in to the DevNet Always on APIC (https://sandboxapicdc.cisco.com/)
The URI to log on using JSON payload is:
https://sandboxapicdc.cisco.com//api/aaaLogin.json

 

Note the URI is in the POST request field

In the Body in RAW format you see the structure of the login payload.  Its basic JSON for the username and password of the user you want to use to log in. Once you have that click on SEND and then note second half of the screen where you see the body of the response.  On the right you should see something like Status: 200 OK

 

That is what you want to look for in every call.  The URIs change depending on what you are doing (what I show here is a specific URI For logging in).

 

2020-07-19_8-16-47.jpg

 

 

Once you get the hang of this its easy to move into Python and in fact POSTMAN will even get you started.  Look for the "Code" link on the right and you can get your request in quite a number of languages.   

 

I strongly recommend using the requests module if you are going to use Python.

 

If you want to try something a bit simpler at the start, I have some example Ansible playbooks that can get you started.

https://github.com/cldeluna/cisco_aci

 

If you are not quite sure what to do with the data you get back here is some information on that.

 

postman-code-2020-07-19_8-28-10.jpg

 

Lastly,  how to find the URIs?

 

Get to know Visore or the "Object Store Browser" on your APIC.

Right click on any object (I show a tenant in the screen shot below) and open up the Object STore Browser (aka Visore). From here you can find the URI and the entire URL.  Spend some time here as this is an incredibly valuable tool for you when you are working with the API.

 

visore2020-07-19_8-25-57.jpg

 

 

showurlvisore2020-07-19_8-37-21.jpg

 

Have fun!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Save 25% on Day-2 Operations Add-On License