License Statistics API allows you to generate information from Utilization History.
Obtaining information about utilization history
To retrieve information about utilization history, use following URL request template.
GET /api/v1/report/feature/${featureId}/utilization-history/${returnType}?sd=${startDate}&ed=${endDate}&st=${startTime}&et=${endTime}&(additional parameters, as needed)
where:
- $ indicates a variable value that you can replace with a proper value, according to your needs
- the possible parameters are as follows:
Parameter | Required | Type | Description |
---|---|---|---|
${featureId} | Yes | integer | Specifies ID of the feature for which you want to view utilization history. |
${returnType} | Yes | string | Specifies the format in which the data should be returned. The format can be one of the following: json, csv, xls or pdf. |
sd | Yes | string | Specifies the starting date from which you want to generate the report. The date format is YYYY-MM-DD; for example, 2017-01-20. |
ed | Yes | string | Specifies the end date from which you want to generate the report. The date format is YYYY-MM-DD; for example, 2017-01-20. The date is inclusive, meaning that all data from a particular day will be included in the report. |
st | Yes | string | Specifies the start time of time window that be applied for each date in range ("working hours"). In format HH:MM; for example, 09:30 |
et | Yes | string | Specifies the end time of time window that be applied for each date in range ("working hours"). In format HH:MM; for example, 09:30 |
incd | No | boolean | Specifies how utilization value should be calculated. That is if downtime periods should be included. If true, length of whole range will be used as denominator ((days between ${sd} and ${ed} inclusively)*(et-st)). Otherwise only uptime periods will be used. Default to false. |
fieldsVisibility | No | json/string | Specifies field visibility settings, for example: {"lc": "1", "lhu": "1", "lutil": "1"} where number "1" indicates that a specific field is visible. |
rn | No | string | Specifies the name of the report that will be displayed once the report has been exported to PDF or XLS. For CSV and JSON formats this parameter will be ignored. If you don't pass this parameter, it will be generated automatically for PDF and XLS types. If provided, it cannot be left empty. |
filter | No | json/string | Applies filtering license usage data on all fields. Use the following format: [ { "type": "numeric", "comparison": "${gt | lt | eq}", "field": "${lc | lhu | lutil}", "value": "${value}" } ] |
limit | No | integer | Determines the maximum number of data records that can be returned. The value must be greater than zero. |
offset | No | integer | Specifies the offset of the first row to return. |
orderBy | No | string | Specifies the field by which you want to order your data records. The field name can be one of the following: ls, lhu, lutil. |
orderDirection | No | string | Determines whether the sorting results will be displayed in an ascending (ASC) or a descending (DESC) order. |
If your request is successful, you should see a response similar to the following:
{ success: ${success}, msg: ${message}, data: [{ "lc": ${licensesInUse}, "lhu": ${hourUsed}, "lutil": ${utilization} }], "code": ${errorCode}, "totalCount": ${totalCount} }
where the response fields can be explained as follows:
Field | Type | Description |
---|---|---|
lc | integer | Number of licenses that other fields are referring to. |
lhu | float | Number of hours when at least ${lc} licenses were used. |
lutil | float | Share of time when at least ${lc} licenses where used in percent. Value of ${lhu} is numerator. Denominator value is affected by ${incd} value. |
msg | string | Error message returned on failure. |
success | boolean | Indicates whether the API request was successfully processed. |
code | integer | Error code for unsuccessful request. |
totalCount | integer | Total number of all matching results. |
Example
Say you would like to view utilization history for feature 3 over some period of time and your employees work from 9 to 5. To generate such data, enter a command similar to the following:
curl --data "sd=2015-01-01" --data "ed=2015-01-02" --data "st=09:00" --data "et=17:00" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/utilization-history/json"