Versions Compared

Key

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

...

License Statistics API allows you to generate data from the User History report. This report shows statistics for license usage per user, during any period that usage was tracked.

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 template.

 

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

There is also another possible endpoint to do this, however it is deprecated.

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

...

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 all sessions for feature 3 ordered by username at a specific 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 view the first 100 sessions for feature 3 at a specific 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

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/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?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/v1/report/user-historyfeature/${featureId}/user-history/${returnType}?ssd=${sessionStartDate}&sed={sessionEndDate}&(additional parameters, as needed)

...

Code Block
languagejs
firstline1
linenumberstrue
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/3/json"

Example 2

Let's assume you want to see all sessions for feature 3 ordered by username over a specific period of time. To do this, enter a command similar to the following:

Code Block
languagejs
firstline1
linenumberstrue
curl --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 3

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:

Code Block
languagejs
firstline1
linenumberstrue
curl --data "limit=100" --data "offset=0" --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"

Sample script

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"
}

...