Getting started with the REST API

Back to top

The REST API is the heart of all programatic interactions with HP Device as a Service Proactive Insights with TechPulse (henceforth Proactive Insights). Proactive Insights provides two kinds of REST APIs - HP TechPulse Analytics API and HP Incident Integration API.

  • The HP TechPulse Analytics API provides insightful analytics on planning and cost optimization and service management capabilities of devices enrolled in Proactive Insights.
  • The HP Incient Integration API provides incident management of Proactive Insights incidents. 

 

 

Authenticating API requests

 

HP recognizes that privacy is a fundamental human right and further recognizes the importance of privacy, security and data protection to our customers and partners worldwide. Whether you are our Customer or Partner, you can count on HP for the protection of your data across all of our operations. In order for your applications to access Proactive Insights APIs, they must be authenticated.  Proactive Insights leverages the industry standard OAuth 2.0 protocol for granting access, due to its simplicity and ease of implementation.

Please read our Authenticating with OAuth 2.0 section for a detailed walk-through of how to get your application authenticated and successfully interacting with Proactive Insights REST APIs. 

 

 

Data Formats

Requesting data from the APIs

All REST APIs return the information requested in JSON data format.

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

{
"totalResults": 10,
"startIndex": 0,
"itemsPerPage": 0,
"resources": [
{
"companyId": "12345",
"deviceType": "Notebook",
"dateListMonth": "Apr 2018",
"deviceCount": 10,
"dataAsOfDate": "04/03/2018",
"counterId": 69362,
"companyName": "company-name",
...
}
]
}
 

 

 

Understanding request throttling

 

All REST API requests are throttled to prevent abuse and ensure stability.  The exact number of calls that your application can make per day varies based on the type of request you are making.  You will find this information alongside the documentation for each specific API call. The Proactive Insights API has an application level throttle in place and allows for only certain total number of calls that your application can make in a day. Please note that for the purposes of request throttling, the API server's "day" is defined as the twenty-four-hour period beginning at midnight UTC and ending at midnight on the following day.

 

 

Handling Large Datasets using Paged Responses

 

When making calls that return a large number of results as a list, it will often be of benefit to page the result set.  By requesting smaller subsets of data, you will get a response much faster than when requesting the entire, potentially large, data set.

On calls that support result set paging, pass in the following parameters to control size and start point of the page:

Paging Parameters

Name
Description
startIndex
An integer indicating the 1-based index of the first query result.
count
An integer indicating the desired maximum number of query results per page.

 

To page through the results, begin with a start value of 0 and a count value of N.  To get the next page, set start value to N, while the count value stays the same.  Subsequent pages will start at 2N, 3N, 4N...

 

You will have paged through all the results once your start value + count value >= the value of "totalResults" in the result set.

For example:

 

POST https://daas.api.hp.com/analytics/v1/reports/hwinv/details/type/grid?startIndex=20&count=10
 
Sample response

{
"totalResults": 345,
"startIndex": 20,
"itemsPerPage": 10,
"resources": [
]
}
 

 

 

Change Data Control

 

HP TechPulse Analytics

Requesting data after specific date time

 

Example - List of devices enrolled after 2019-01-08
HTTP Request
POST /analytics/v1/reports//hwinv/details/type/grid?count=100&attributes=resources.deviceId,resources.counterId, totalResults HTTP/1.1
Host: daas.api.hp.com
Content-Type: application/json
Authorization: Bearer Access Token
Body: 
{
"filter": "datelistMonth gt \"2019-01-08T11:59:05Z\""
}


HTTP response
{
"totalResults": 366,
"resources": [
{
"counterId": 14436,
"deviceId": "12345"
},
... // 366 Records
]
}

 

Requesting data in between specific date time

 

Example - List of devices enrolled date between 2019-01-08 and 2019-01-09
HTTP Request
POST /analytics/v1/reports//hwinv/details/type/grid?count=100&attributes=resources.deviceId,resources.counterId, totalResults HTTP/1.1
Host: daas.api.hp.com
Content-Type: application/json
Authorization: Bearer Access Token
Body: 
{
"filter": "datelistMonth gt \"2019-01-08T11:59:05Z\" and datelistMonth gt \"2019-01-09T11:59:05Z\" "
}


HTTP response
{
"totalResults": 126,
"resources": [
{
"counterId": 68944,
"deviceId": "12345"
},
... // 126 Records
]
}
 
Below some use-cases of change data control
 
Report Name
Use case
Filter example
Hardware Inventory
Devices enrolled after specific date
Body: { "filter": "datelistMonth gt \"2019-01-08T11:59:05Z\"" }

 

HP TechPulse Incident Integration

Requesting data after specific date time

 

Example - List of incidents created after 2019-03-05 00:00:00
HTTP Request
POST/analytics/v1/incidents/1.2/tenants/{tenantId}/incidents?filter=createdAt ge "2019-03-05 00:00:00"&startIndex=0&count=10 HTTP/1.1
Host: daas.api.hp.com
Content-Type: application/json
Authorization: Bearer Access Token
Body: 
{
	Request Payload: {tenantIds: []}
}


HTTP response
{"totalResults":38,"startIndex":0,"itemsPerPage":10,
"resources":[
    {
        "id":123456,
        "guid":"XYZA-123456",
        "displayId":"456789",
        "createdAt":1551857130279,
        "updatedAt":1551857130292,
        "occuredAt":1551744000000,
        "description":"Low disk space has been detected for disk (disk-sn, disk-model) on device device-name with user user-name, Logged On User= user-name. Amount of disk consumed is 91-100%. Low disk space may impact system stability, update installation and performance. Device operating system: Windows 10.",
        "title":"Hard drive low disk space",
        "deviceId":"XYZ-12345678",
        "type":{"name":"HW_HEALTH","value":"Hardware Health"},
        "subtype":{"name":"HDD_STORAGE_FULL","value":"HDD Storage Capacity Full"},
        "os":"Windows10",
        "tenantId":"abcdef12-3456-789g-hi0j-k11l121314lm",
        "userId":"abcdef12-3456-789g-hi0j-k11l121314lm",
        "sourceId":"123456",
        "sourceLocation":"predalerts",
        "priority":{"name":"CRITICAL","value":"Critical"},
        "status":{"name":"NEW","value":"New"},
        "lastAssigeeUpdatedAt":0,
        "lastStatusUpdatedAt":1551857130279,
        "metadata":"{\"metaDataName\":\"SerialNumber\",\"metaDataProperty\":\"enabled\",\"metaDataValue\":\"device-sn\",\"metaDataUnit\":null}",
        "measureId":"123",
        "companyDetails":
            {
                "id":456,
                "tenantId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "companyName":"company-name",
                "isDeleted":false
            },
        "userDetails":
            {
                "id":789,
                "userId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "userName":"user-name",
                "emailId":"user-name@hp.com",
                "isDeleted":false
            },
        "deviceDetails":
            {
                "id":284,
                "deviceId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "deviceName":"device-name",
                "serialNumber":"device-sn",
                "deviceModel":"device-model",
                "deviceManufacturer":"HP",
                "isDeleted":false
            },
        "isDeleted":false
    },
.....
]}

 

Requesting data between specific date time

 

Example - List of updated incidents beween 2019-01-08 and 2019-03-15
HTTP Request
POST /analytics/v1/incidents/1.2/tenants/{tenantId}/incidents?filter=updatedAt ge "2019-01-08 00:00:00"&updatedAt le "2019-03-15 23:59:59"&startIndex=0&count=10 HTTP/1.1
Host: daas.api.hp.com
Content-Type: application/json
Authorization: Bearer Access Token
Body: 
{
  {tenantIds: []}
}


HTTP response
{"totalResults":38,"startIndex":0,"itemsPerPage":10,
"resources":[
    {
        "id":123456,
        "guid":"XYZA-123456",
        "displayId":"456789",
        "createdAt":1551857130279,
        "updatedAt":1551857130292,
        "occuredAt":1551744000000,
        "description":"Low disk space has been detected for disk (disk-sn, disk-model) on device device-name with user user-name, Logged On User= user-name. Amount of disk consumed is 91-100%. Low disk space may impact system stability, update installation and performance. Device operating system: Windows 10.",
        "title":"Hard drive low disk space",
        "deviceId":"XYZ-12345678",
        "type":{"name":"HW_HEALTH","value":"Hardware Health"},
        "subtype":{"name":"HDD_STORAGE_FULL","value":"HDD Storage Capacity Full"},
        "os":"Windows10",
        "tenantId":"abcdef12-3456-789g-hi0j-k11l121314lm",
        "userId":"abcdef12-3456-789g-hi0j-k11l121314lm",
        "sourceId":"123456",
        "sourceLocation":"predalerts",
        "priority":{"name":"CRITICAL","value":"Critical"},
        "status":{"name":"NEW","value":"New"},
        "lastAssigeeUpdatedAt":0,
        "lastStatusUpdatedAt":1551857130279,
        "metadata":"{\"metaDataName\":\"SerialNumber\",\"metaDataProperty\":\"enabled\",\"metaDataValue\":\"device-sn\",\"metaDataUnit\":null}",
        "measureId":"123",
        "companyDetails":
            {
                "id":456,
                "tenantId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "companyName":"company-name",
                "isDeleted":false
            },
        "userDetails":
            {
                "id":789,
                "userId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "userName":"user-name",
                "emailId":"user-name@hp.com",
                "isDeleted":false
            },
        "deviceDetails":
            {
                "id":284,
                "deviceId":"abcdef12-3456-789g-hi0j-k11l121314lm",
                "deviceName":"device-name",
                "serialNumber":"device-sn",
                "deviceModel":"device-model",
                "deviceManufacturer":"HP",
                "isDeleted":false
            },
        "isDeleted":false
    },
.....
]}