5

I've been reading about Cisco APIC REST API User Guide - https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/1-x/api/rest/b_APIC_RESTful_API_User_Guide/performing_common_tasks.html

and managed to get in using JSON API in Postman.

Example (as documented in the link above):

POST https://192.0.20.123/api/aaaLogin.json

{
"aaaUser":{
"attributes":{
"name":"georgewa",
"pwd":"paSSword1"
}
}
}

There are bunch of examples in the document on how to make changes on the ACI, but I couldn't find any examples to make a simple query without making any changes.

Let say how to get/read the current configuration in ACI, let say NTP or SNMP setting using API request?

  • Which tool are you using to send REST API? PostMan, curl .. etc – user May 20 at 13:37
3

If you are using PostMan to send REST API, first of all, you need to login into the APIC controller.

For example:

Method: POST Body raw, Type xml:

https://IP_ADDRESS_APIC/api/mo/aaaLogin.xml

<aaaUser name='USERNAME' pwd='PASSWORD'/>

You will receive a token stored in a cookie which postman will store for you, It will last 5 minutes. After 5 minutes, you will need to log in again.

After that, you can run REST API.

For example:

Method: GET

https://IP_ADDRESS_APIC/api/class/datetimeNtpProvider.xml

In order to get all the NTP providers configured in the fabric.

If you prefer json format, then change REST URL to:

Method: GET

https://IP_ADDRESS_APIC/api/class/datetimeNtpProvider.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.