Exploring Aruba 8.x API via Postman
Postman is a great tool to test APIs, we can make a group of API calls known as collection in Postman. The collection could also be run from CLI via Newman.
Postman has a lot of good documentation to start and test the API function. The ArubaOS 8.x though provide the swagger interface which could be directly used to test and run APIs, however the collection function on Postman provides good automation function.
I will use Postman to take a tech support logs and export it to external tftp/ftp server.
Difference between Params and Body in Postman:
Params correspond to the request parameters that are appended to the request URL.they are most used with GET requests. On the other hand, Body is the actual request body (usually it defines the request payload or the data needs to be processed by the request). PUT and POST requests are usually read the data from the body of the request and not from the params.
Login to Aruba Controller via Postman:
The Aruba API Guide provides good documentation on the APIs available on the 8.x version. You can also goto the Swagger Interface for the device by logging to the MM and going to the url: https://<controller-ip>:4343/api
Please note that the port number 4343 should be open on the FW and/or allowed on the controller.
I will use the post function in postman with the username and password keys in the body of the put request to login, a successfull authentication will return a UIDARUBA which can be used as a token for all the subsequent GET/SET requests after the login attempt.
In the above example I have used collection variables to enter username and password as a variable to the post function. Postman also provides option to write test scripts to capture responses and validate the success/failure of the function. We also used this script to capture the value of UIDARUBA from the response and set it as a variable for subsequent functions.
The variables are saved as Collection variables:
I am running another request in the Postman Collection to create a logs.tar file on the Aruba Controller. The Post Params and body content requirement can be captured from the controller swagger interface.
Please set the body content format as JSON.
The final Post request would be to tftp tranfer the logs.tar.7z file from the flash: to the tftp Server.
The review of the MM audit-trail logs did confirmed the command pushed for generating the logs.tar file and the tftp transfer.