Cisco ACI - Logging in from Postman Using the API

ACIAPICCisco

 Most Network Engineers I know are like me, and are largely stuck in our ways of using the CLI. Cisco ACI is almost entirely GUI-based and really there isn't much you can do via the CLI. 


Tasks that used to be so simple are now increasingly time-consuming. For Example; I had to configure an access port last week and it took me 10 minutes to get all the options correctly selected before I was done configuring the port.

What used to be an easy procedure, whether manual or not, is now far more complicated, with several steps that can be easily missed. 

To that end: I've started using the Postman Collection Runner to ensure I'm not missing any of the steps needed to complete these tasks. 

Anyway, the first step to using the API is knowing how to get the API Token, which I'll now go over using Cisco's sandbox APIC found at sandboxapicdc.cisco.com.


Open Postman, and click "+New Collection."

Name it whatever name you prefer, and click "Create".

Under your collection click "Add requests"


Name it whatever you want and click "Save".

It will create a "GET", which is what you need when you're requesting information, but we are pushing/sending information.

So we need to flip the drop down inside of the request from "GET" to "POST"


You can use the following URL to test against the sandbox, but you can change the hostname to your own APIC.
https://sandboxapicdc.cisco.com/api/aaaLogin.json

Under Body you can use the following credentials to test against the sandbox, but you can change them to your own APIC.
{ "aaaUser" : { "attributes": {"name":"admin","pwd":"ciscopsdt" } } } 


Here you receive your token.

Postman stores it now automatically, so you can send your GET/POST requests and it will pass the token along.



Cisco's official documentation for their API is found here

Categories: ACI, APIC, Cisco