License Statistics API allows you to generate data from the License Server Current Usage page, which shows general information about the license server and its features.
Obtaining information about license server or license server group current usage
If you want to retrieve information about current usage of a single license server, we recommend that you use the following URL request template.
GET /api/v1/report/license-server/${lsid}/current-usage/${returnType}
To retrieve information for a license server group, use the following URL.
GET /api/v1/report/license-server-group/${lsgid}/current-usage/${returnType}
The possible parameters are as follows:
Parameter | Required | Type | Description |
---|---|---|---|
${lsid} | Yes | integer | License Server ID. |
${lsgid} | Yes | integer | License Server Group ID. |
${returnType} | Yes | string | Specifies the format in which license usage data should be returned. The format can be one of the following: json, csv, xls or pdf. |
fieldsVisibility | No | json/string | Specifies field visibility settings, for example: { "fid": "1", "fns": "1", "fv": "1", "ftype": "1", "fu": "1", "fbrwd": "1", "frvd": "1", "ft": "1", "futil": "1", "fexp": "1", "flu": "1" } where "1" indicates that a specific field is visible and ''0" indicates it is not. Note that the order of the settings you make is important – when exported, the fields will be visible in exactly the same order you specify here. |
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. To filter by string column, use the following format: [ { "type": "string", "field": "${ fns | fv | ftype | fexp | flu }", "value": "${value}" } ] To filter by a numeric column, use the following format:
[ { "type": "numeric", "comparison": "${gt | lt | eq}", "field": "${ fu | fbrwd | frvd | ft | futil}", "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:fid, fns, fv, ftype, fu, fbrwd, frvd, ft, futil, fexp, flu. |
orderDirection | No | string | Determines whether the sorting results will be displayed in ascending (ASC) or descending (DESC) order. |
If your request is successful, you should see a response similar to the following:
{ success: ${success}, msg: ${message}, data: [{ "fid": "${featureId}", "fns": "${featureName}", "fv": "${featureVersion}", "ftype": "${featureType}", "fu": "${licensesUsed}", "fbrwd": "${licensesBorrowed}", "frvd": "${licensesReservations}", "ft": "${total}", "futil": "${licenseUtilization}", "fexp": "${expireDate}", "flu": "${lastUsageUpdateDate}", "fiexp": "${isExpired}" }], "code": ${errorCode}, "totalCount": ${totalNumberOfRecords} }
where the response fields can be explained as follows:
Field | Type | Description |
---|---|---|
fid | integer | Feature ID. |
fns | string | Feature name. |
fv | string | Feature version. |
ftype | string | Feature type. |
fu | integer | Number of used licenses. |
fbrwd | integer | Number of borrowed licenses. |
frvd | integer | Number of reserved licenses or "N/A" string if License Reservations are not supported by the license server. |
ft | integer | Total licenses for a feature or "Unlimited" string in case of unlimited license. |
futil | integer | Percentage of feature utilization. |
fexp | string | Feature expiration date in YYYY-MM-DD format. |
flu | string | Feature last update time in YYYY-MM-DD hh:mm:ss format. |
fiexp | boolean | Indicates whether the feature has expired. |
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 rows. |
Note: Data returned for license server group consists of a summary of all features of all license servers in the group, including hidden ones. (See License server groups for more information.)
Example 1
Say you want to download statistics about current usage for license server 7 as an XSL file. To generate such data, enter a command similar to the following:
curl -H "X-Auth-token: token" "http://yourdomain/api/v1/report/license-server/7/current-usage/xsl"
Example 2
If you want to obtain information features with current usage higher than 90% for license server 13, enter the following command:
curl -H "X-Auth-token: token" "http://yourdomain/api/v1/report/license-server/13/current-usage/json" --data-urlencode 'filters=[{"type":"numeric","comparison":"gt","field":"futil","value":"90"}]'
Example 3
Let's assume you want to download statistics about current usage for license server group 1 in CSV format. To generate such data, enter a command similar to the following:
curl -H "X-Auth-token: token" "http://yourdomain/api/v1/report/license-server-group/13/current-usage/csv"