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:

  1. Configure the things needed in Clearpass to access the API form outside systems.
  2. Login to the device API
  3. Construct a GET request
  4. Construct a POST request


  1. 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
    1. https://developer.arubanetworks.com/aruba-cppm/docs/clearpass-configuration
  2.     Login to the device (using administrative credentials created in the previous step). 
      1. According to the documentation, the URL is:  http://Clearpass-IP/api/oauth
      2. In Postman, construct it like this:
        1.  It's a http POST to the URL
        2. 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
        3.  
      3. If everything is ok you'll get a response like this:
        1. 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.
  3. Construct a GET request
      1.  According to the documentation, to obtaint the guests accounts the URL is:  https://Clearpass-IP/api/guest
        1. It's a GET to the URL
        2. This time we use a Authorization section to include the acesss_token  value gotten in the login step
        3. We don't need anything  else if we want all the guests accounts
        4. If everything is ok, you'll get something like this:
  4. Construct a POST request
      1. According to the documentation, to create a guest the URL is:  https://Clearpass-IP/api/guest
      2. It's a POST to the URL
      3. This time we use a Authorization section to include the acesss_token  value gotten in the login step
      4. 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.
      5. 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

Comments

Post a Comment

Popular posts from this blog

Aruba Clearpass - How to configure the Cisco WLC for Guest and MAC Caching by Ulises Cázares

Using API in ArubaOS Switches with Postman by Ulises Cázares

WiFi - How to know supported channels by a wireless client by Ulises Cázares