Using API in Aruba Clearpass with Postman by Ulises Cázares
Hi, today I'm gonna show how to interact with Aruba Clearpass 6.9.X API using postman.
My intention is that you know how to construct the request using headers, parameters and the body of the request.
The
first things to start working with the Clearpass API are: to have
administrative access to the device and to see the API documentation inside the Clearpass itself.
To access the Clearpass API documentation go to Guest-Adminsitration-API Services-API Explorer
Once you click there, you'll be redirected to a page like this.
Now, let's do 4 thing so you can use the API:
- Configure the things needed in Clearpass to access the API form outside systems.
- Login to the device API
- Construct a GET request
- Construct a POST request
- Configure the things needed in Clearpass to access the API form outside systems. In this post you can find everything you need. Just make SURE the Operator profile has API access or you'll get an error when running the requests
- https://developer.arubanetworks.com/aruba-cppm/docs/clearpass-configuration
- Login to the device (using administrative credentials created in the previous step).
- According to the documentation, the URL is: http://Clearpass-IP/api/oauth
- In Postman, construct it like this:
- It's a http POST to the URL
- In the body use "grant_type", "username", "password" and "client_id" variables that you created in the previous step. Note.- The variables are case sensitive
- If everything is ok you'll get a response like this:
- This respone includes the access_token so you can make requests. Copy the access_token value becasue you'll use it in the next sections.
- Construct a GET request
- According to the documentation, to obtaint the guests accounts the URL is: https://Clearpass-IP/api/guest
- It's a GET to the URL
- This time we use a Authorization section to include the acesss_token value gotten in the login step
- We don't need anything else if we want all the guests accounts
- If everything is ok, you'll get something like this:
- Construct a POST request
- According to the documentation, to create a guest the URL is: https://Clearpass-IP/api/guest
- It's a POST to the URL
- This time we use a Authorization section to include the acesss_token value gotten in the login step
- Since we're creating something we need more information in the request. In this case, we need at least the following: username, password and role_id.
- If everythig is ok you'll get something like this:
When you get an error after a GET or a POST review the code of the status, it'll give you a clue or reason of why the method didn't work.
In order to do more things with the switch API, refer to the API Explorer in Clearpass
Hope this helps
Great post!
ReplyDelete