Accessing the API with Postman

Tutorial Logistics & Prerequisites

  • This tutorial assumes you have a Developer App created, registered, and approved for our API.
  • You also need a TechPulse account with a minimum role of Report Admin.
  • This tutorial uses Postman in its examples.  (Get Postman: https://www.getpostman.com/)
  • This tutorial uses our HP TechPulse Analytics API.

An API can be thought of as a collection of routes or endpoints that return data to your code/tool based on parameters you send to it.  You can find all of the available TechPulse Analytics API endpoints in our HP Analytics API Documentation.  For this tutorial, as example, we will use our Hardware Inventory API with the following endpoint:

 

Within the API documentation, you can expand the endpoint to see how to use it:

 


 

Tutorial on how to access our API

  1. Launch Postman (You can skip signing in and just use the App on your local machine)

  2. Create a basic request:

     

  3. Name your request and create a “collection” to put it in.

     

  4. Change the HTTP Request Type to POST and enter the following string into the url field:

    https://daas.api.hp.com/analytics/v1/reports/hwinv/details/type/grid

    This string is the domain of the US API, daas.api.hp.com, combined with the address of the endpoint we talked about earlier, /analytics/v1/reports/hwinv/details/type/grid. The https:// means we are using the encrypted https protocol so all communications are completely encrypted.

     

  5. Now click Send and notice that it is not working because the API doesn’t know who we are. 

     

  1. Add details that will allow us to authenticate with the API.
  1. On the Headers tab, add a KEY of "Content-Type" with a VALUE of "application/json"​

     

  2. On the Authorization tab, choose OAuth 2.0

     

  3. Obtain the API Client ID, API Secret, and Developer Redirect URL from your registered and approved Developer App for the HP TechPulse Analytics API.  If not already defined, I suggest using http://127.0.0.1:5000/  for the value of Redirect URL (which will be used as the Callback URL in Postman).

     

  4. Configure and Get New Access Token

    Copy and paste the parameters you need from here and from your Developer App (click on the App to see its details).

    Token Name                   code
    Grant Type                   Authorization Code
    Callback URL                 {Insert the value of Developer Redirect URL from your Developer App}
    Auth URL                     https://daas.api.hp.com/oauth/v1/authorize
    Access Token URL             https://daas.api.hp.com/oauth/v1/token
    Client ID                    {Insert the value of API Client ID from your Developer App}
    Client Secret                {Insert the value of API Secret from your Developer App}
    Scope                        Read
    State                        RANDOMSTRING
    Client Authentication        Send as Basic Auth header
    

     

     

  5. Sign in with the same account you use for hpdaas.com

     

  6. Once successfully authenticated you will see this screen. Click Use Token:

     

  1. Now re-click Send and notice that the API call was successful using the access token

     

And That is all! You have successfully called our API!