07-18-2020 09:02 PM
how to navigate to aci-api? how to know all uri for rest api? is there easy way?
07-19-2020 03:15 AM
here is the good reference thread to start :
https://community.cisco.com/t5/application-centric/aci-rest-api-custom-reporting/m-p/4007785
07-19-2020 08:38 AM
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).
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.
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.
Have fun!
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