Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn the REST API with the CLI

Introduction

 

The CLI has to use the REST API to get data just like the GUI and the Python SDK does.  When you traverse the management information tree using the cli, all of the queries the CLI makes to the APIC are logged to:

 

/var/log/dme/log/neo.log

We can take advantage of this to learn more about the REST API.

 

Procedure

 

  • Open two ssh sessions to the same APIC.
  • In one of the ssh sessions, tail the log that the CLI writes to when you traverse the management information tree:

 

tail -f /var/log/dme/log/neo.log

 

  • In the other session start traversing the /debug, /aci or /mit directories, looking at summary and mo files with cat and you can even change things with moset and moconfig and see what queries the cli does to get the data.

 

Example:

 

This command:

 

cat /debug/tsi-apic1-211/nginx/summary

 

Does this query:

 

'32509||139660159612672||2014-06-14 01:55:45,343||neo||INFO||Debug url: http://127.0.0.1:80/api/nginx/debug/.xml?system=1&query-target=subtree||/mgmt/opt/controller/ishell/insieme/rest/restdbgaccess.py||132'

 

And:

 

cat /debug/rtp_leaf1/nginx/summary

 

Does this query:

 

'32509||139659778713344||2014-06-14 01:56:49,151||neo||INFO||Debug url: http://127.0.0.1:80/api/nginx/debug/.xml?system=101&query-target=subtree||/mgmt/opt/controller/ishell/insieme/rest/restdbgaccess.py||132'
Version history
Revision #:
1 of 1
Last update:
‎08-21-2014 07:21 AM
Updated by: