Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Warning
This page refers to functionality that has been removed from License Statistics. This information no longer applies to License Statistics v6.3 and newer.

The User History endpoint delivers license usage metrics specific to the User History report, allowing you to seeThe License Statistics API lets you generate data from the User History report. This report shows statistics for license usage per user, during any period that usage was tracked.

Anchor
feature
feature
Showing sessions at a specific point in time

If you want to retrieve information about usage history at a particular point in time, we recommend that you use the following URL request templateYou can easily fetch metrics about user session history by sending the following HTTP request.

Code Block
languagejs
firstline1
linenumberstrue
GET /api/v1/report/user-historyfeature/${featureId}/user-history/${returnType}?sdt=${sessionDateTime}&(additional parameters, as needed)

where :- $ $ indicates a variable value that you can replace with an appropriate value, as needed- the a value that best suits your needs. The possible parameters are as follows:described below.

ParameterRequiredTypeDescription
${featureId}Yesinteger
Specifies feature-specific parameters
Internal License Statistics identification of the feature for which you want to view user history.
${returnType}Yesstring
Specifies the format in which license usage data should be returned. The format can be one of the following: json, csv, xls or pdf
Standard format option. See Making an API request for details.
sdt
Yes
No
stringSpecifies point
date and timePoint in time for which you want to generate the report.
The date and time format is as follows: YYYY-MM-DD HH:MM; for example, 2015-01-20 11:00.
fieldsVisibility Nojson/string

Specifies field visibility settings, for example:

Code Block
languagejs
firstline1
linenumberstrue
{"un": "1", "hn": "1", "sst": "1", "set": "1"}

where number "1" indicates that a specific field is visible.
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.

rnNostringSpecifies the name of the report that will be displayed once the report has been exported to PDF or Excel.filterNojson/string

Applies filtering license usage data on all fields. To filter your data, use the following format:

Code Block
languagejs
firstline1
linenumberstrue
[{"value": intOrString, "field": "${fid | fns | fv | ftype | lsid | lsn | vn | gtn}"}]
limitNointegerDetermines the maximum number of data records that can be returned. The value must be greater than zero.offsetNointegerSpecifies the offset of the first row to return.orderByNostring

Specifies the field by which you want to order your data records. The field name can be one of the following: uid, un, hn, sst, set.

orderDirectionNostringDetermines 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:

Code Block
languagejs
firstline1
linenumberstrue
{
success: true, 
msg: ${message}, 
data: [{
  uid: ${userId}, 
  un: ${userName},
  hn: ${hostName},
  sst: ${sessionStartTime},
  set: ${sessionEndTime},
  il: ${hasUserLdapDetails}
}]
}

where the response fields can be explained as follows:

Cannot be used with "ssd" and "sed".
ssdNodate

Start date for which the report will be generated.

sedNodate

End date for which the report will be generated.

standard report optionsNovarious

See Making an API request for details.

Note: Either "sdt" or both "ssd" and "sed" must be specified.

Response

On success, this report will contain:

  • if parameter "sdt" was used, one row for each session that started before or at the specified point in time and ended after or upon the specified point in time.
  • if parameters "ssd" and "sse" were used, one row for each session that overlaps with the specified time range.

Each row consists of the following columns.
FieldTypeDescriptionuidintegerUser Id.unstringUsername.hnstringHostname.sststringDate returned in YYYY-MM-DD HH:MM format; for example, 2016-01-20 11:00.setstringDate returned in YYYY-MM-DD HH:MM format (for example, 2016-01-20 11:00), "Unknown", or "Still in use".ilbooleanThis field indicates whether user details have been imported from
FieldFull nameTypeDescriptionVisible by default in export
uidUser IDintegerUser ID.(minus)No
unUserstringUsername.(tick)Yes
hnHoststringHostname.(tick)Yes
sstStart Timedate and time
Time when the license was checked out.(tick)Yes
setEnd Timedate and time/stringTime when the license was checked in, or "Still in use."(tick)Yes
tuTime UsedstringHow long the license has been in use. Note that you cannot filter on this field.(tick)Yes
uilUser is from LDAPbooleanIndicates whether user details have been imported from the
LDAP directory. Note that you cannot filter and order data by this field.
msgstringError message returned on failure.successbooleanThis field indicates that the API request was successfully processed
(error) Unavailable

Note that order in table is default order of columns in exported file.


Example 1

For example, say you would like to view The following example shows a command that lets you obtain information about all sessions for feature "3" at a specific specified time point. To generate such data, enter a command that is similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curl --data-urlencode "sdt=2015-10-30 00:00" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/3/json"

Example 2

Let's assume you would like to see The following example shows a command that lets you obtain statistics about all sessions for feature "3 ordered by username " at a specific specified time point. To do this, enter a command similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curl --data "orderBy=un" --data "orderDirection=ASC" --data-urlencode "sdt=2015-10-30 00:00" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/3/json"

Example 3

Say you need to The following example shows a command that lets you view the first 100 sessions for feature "3" at a specific specified time point. To do this, you need to enter a command similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curl --data "limit=100" --data "offset=0" --data-urlencode "sdt=2015-10-30 00:00" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/3/json"

Sample script


Example 4

The following example shows a command that lets you view all sessions for feature "3" for a specified time period.This sample PowerShell 3.0 script serves as a template for generating PDF reports to a file for features with a specific name and for a license server of your choosing. The script saves reports to a file under a filename that follows the pattern: UserHistory-${featureId}.pdf. You can easily adapt this script to any target parameters you'd like to use to generate the desired report. The number of generated PDF files corresponds to the number of features meeting the defined criteria.

Code Block
languagejs
firstline1
linenumberstrue
$token = "Yourtoken"
$url = "http://yourdomain/api/report"
$features = Invoke-RestMethod "$($url)/feature/json?fns=FeatureName&lsn=LicenseServerName" -Headers @{"X-Auth-token"="$($token)"}

for ($i=0; $i -lt $features.data.fid.Length; $i++) { 
    Invoke-RestMethod "$($url)/user-history/$($features.data.fid[$i])/pdf?sdt=2016-02-03 00:00" -Headers @{"X-Auth-token"="$($token)"} -OutFile "UserHistory-$($features.data.fid[$i]).pdf"
}

Showing sessions over a specific time period

If you want to retrieve information about usage history over a specific period of time, we recommend that you use the following URL request template:

Code Block
languagejs
firstline1
linenumberstrue
GET /api/report/user-history/${featureId}/${returnType}?ssd=${sessionStartDate}&sed={sessionEndDate}&(additional parameters, as needed)

where:

- $ indicates a variable value that you can replace with an appropriate value, as needed

- the possible parameters are as follows:

...

Specifies the start date for which the report will be generated in YYYY-MM-DD format; for example, 2016-01-20.

...

Specifies the end date for which the report will be generated in YYYY-MM-DD format; for example, 2016-01-27.

...

Specifies field visibility settings, for example:

Code Block
languagejs
firstline1
linenumberstrue
{"un": "1", "hn": "1", "sst": "1", "set": "1"}

where number "1" indicates that a specific field is visible.
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.

...

curl --data "ssd=2015-01-01" --data "sed=2015-01-02" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/json"

Example 5

The following example shows a command that lets you see all sessions for feature "3" for a specified time period, and orders the data by username.

...

Applies filtering license usage data on all fields. To filter your data, use the following format:

Code Block
languagejs
firstline1
linenumberstrue

...

[{"value": intOrString, "field": "${un | hn | sst | set}"}]

...

If your request is successful, you should see a response similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
{success: true, msg: ${message}, data: [
  uid: ${userId}, 
  un: ${userName},
  hn: ${hostName},
  sst: ${sessionStartTime},
  set: ${sessionEndTime},
  il: ${hasUserLdapDetails}
]}

where the response fields can be explained as follows:

FieldTypeDescription
uidintegerUser Id.
unstringUsername.
hnstringHostname.
sststringDate returned in YYYY-MM-DD HH:MM format; for example, 2016-01-20 11:00.
setstringDate returned in YYYY-MM-DD HH:MM format (for example, 2016-01-20 11:00), "Unknown", or "Still in use".
ilbooleanThis field indicates whether user details have been imported from LDAP directory. Note that you cannot filter and order data by this field.
msgstringError message returned on failure. 

...

For example, say you would like to view all sessions for feature 3 over some period of time. To generate such data, enter a command that is similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curlcurl --data "orderBy=un" --data "orderDirection=ASC" --data "ssd=2015-01-01" --data "sed=2015-01-02" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/3/json"

Example 26

The following example shows a command that lets you view the first 100 Let's assume you want to see all sessions for feature "3 ordered by username " over a specific specified time period of time. To do this, enter a command similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curl --data "orderBylimit=un100" --data "orderDirectionoffset=ASC0" --data "ssd=2015-01-01" --data "sed=2015-01-02" -H "X-Auth-token: token" "http://yourdomain/api/v1/report/feature/3/user-history/3/json"

Example 3

Sample script 1

Let's assume you're interested in viewing the first 100 sessions for feature 3 over a specific period of time. To do this, enter a command that is similar to the following:This sample PowerShell 3.0 script serves as a template for generating PDF reports to a file for features with a specific name and for a license server of your choosing. The script saves reports to a file under a filename that follows the pattern: UserHistory-${featureId}.pdf. You can easily adapt this script to any target parameters you'd like to use to generate the desired report. The number of generated PDF files corresponds to the number of features meeting the defined criteria.

Code Block
languagejs
firstline1
linenumberstrue
curl$token --data= "limit=100" --data "offset=0" --data "ssd=2015-01-01" --data "sed=2015-01-02" -H Yourtoken"
$url = "http://yourdomain/api/v1/report"
$features = Invoke-RestMethod "$($url)/feature/json?fns=FeatureName&lsn=LicenseServerName" -Headers @{"X-Auth-token"="$($token)"}

for ($i=0; $i -lt $features.data.fid.Length; $i++) { 
    Invoke-RestMethod "$($url)/feature/$($features.data.fid[$i])/user-history/pdf?sdt=2016-02-03 00:00" -Headers @{"X-Auth-token: token" "http://yourdomain/api/report/user-history/3/json"

...

"="$($token)"} -OutFile "UserHistory-$($features.data.fid[$i]).pdf"
}

Sample script 2

This sample PowerShell 3.0 script can be used as a template for generating PDF reports to a file for features with a specific name and for a license server of your choosing. The script saves reports to a file under a filename that follows the pattern: UserHistoryForPeriod-${featureId}.pdf. You can easily adapt this script to any target parameters you'd like to use to generate the desired report. The number of generated PDF files corresponds to the number of features meeting the defined criteria.

Code Block
languagejs
firstline1
linenumberstrue
$token = "Yourtoken"
$url = "http://yourdomain/api/v1/report"
$features = Invoke-RestMethod "$($url)/feature/json?fns=FeatureName&lsn=LicenseServerName" -Headers @{"X-Auth-token"="$($token)"}

for ($i=0; $i -lt $features.data.fid.Length; $i++) { 
Invoke-RestMethod "$($url)/user-historyfeature/$($features.data.fid[$i])/user-history/pdf?ssd=2016-02-03&sed=2016-02-10" -Headers @{"X-Auth-token"="$($token)"} -OutFile "UserHistoryForPeriod-$($features.data.fid[$i]).pdf"
}

...