Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Some information on this page refers to License Statistics v5.7 or newer, which changed the API endpoint URL in order to maintain version integrity into the future. If you are running a previous version of License Statistics, please refer to v5.4-v5.6 documentation.

The User History endpoint delivers metrics License Statistics collects from the monitored license server. This endpoint is used to fetch license usage metrics specific to the User History report, allowing you to see statistics for license usage per user, during any period that usage was tracked.

...

You can easily fetch metrics about usage history at a particular point in time by calling this sending the following HTTP GET request:.

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

where $ indicates a variable value that you can replace with a value that best suits your needs and the possible parameters are can be explained as follows:.

ParameterRequiredTypeDescription
${featureId}Yesinteger

Specifies feature-specific parameters.

${returnType}YesstringSpecifies the format in which license usage data should be returned. The format can be one of the following: json, csv, xls or pdf.
sdtYesstringSpecifies point in time for which you want to generate the report. The date is in YYYY-MM-DD HH:MM format; for example, 2017-05-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 XLS.
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

(See this section for more field-specific information.)

orderDirectionNostringDetermines whether the sorting results will be displayed in ascending (ASC) or descending (DESC) order.

The following code block shows an example result of a successful request:.

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

Anchor
fields def
fields def

FieldTypeDescription
uidintegerUser ID.
unstringUsername.
hnstringHostname.
sststringDate returned in YYYY-MM-DD HH:MM format; for example, 2017-05-20 11:00.
setstringDate returned in YYYY-MM-DD HH:MM format (; for example, 2017-05-20 11:00), "Unknown" , or "Still in use".
ilbooleanIndicates 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.
successbooleanIndicates that whether your API request was successfully processed.


Example 1

For example, say Say you would like to view obtain information about all sessions for feature "3" at a specific point in time point. To generate such this data set, 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/json"

...

Let's assume you would like to see obtain statistics about all sessions for feature "3 ordered by username " at a specific time point. In addition, you want your data to be ordered by username. To do generate this data set, 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/json"

...

Say you need to view the first 100 sessions for feature "3" at a specific time point. To do obtain this data set, you need to enter a command that is similar to the following:one you can see below.

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/json"

...

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)/feature/$($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

...

for a

...

given time period

You can easily fetch metrics about usage history over for a given timeframe by calling this HTTP GET request:time period by sending the following HTTP request.

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

where $ indicates a variable value that you can replace with a value that best suits your needs and the possible parameters are can be explained as follows:.

ParameterRequiredTypeDescription
${featureId}YesintegerSpecifies feature-specific parameters.
${returnType}YesstringSpecifies the format in which license usage data should be returned. The format can be one of the following: json, csv, xls or pdf.
ssdYesstring

Specifies the start date for which the report will be generated The date is in YYYY-MM-DD format; for example, 2017-05-20.

sedYesstring

Specifies the end date for which the report will be generated. The date is in YYYY-MM-DD format; for example, 2017-05-27.

fieldsVisibility  

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": "${un | hn | sst | set}"}]
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 

(See this section for more field-specific information.)

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:The following code block shows an example result of a successful request.

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

The following code block shows an example result of a successful request: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, 2017-05-20 11:00.
setstringDate returned in YYYY-MM-DD HH:MM format (for example, 2017-05-20 11:00), "Unknown" , or "Still in use".
ilbooleanIndicates 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. 


Example 1

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

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/json"

...

Let's assume you want to see all sessions for feature "3" for a given time period. Additionally, you would like your data to be ordered by username over a specific period of time. To do generate this data set, 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/json"

...

Let's assume you're interested in viewing the first 100 sessions for feature "3" over a specific period of timetimeframe.  To do obtain this information, 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/json"

...