You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 62 Next »

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 the documentation for releases prior to v5.7.

Obtaining information about usage history for a single feature

You can easily fetch metrics about usage history for a single feature by sending the following HTTP request.

GET /api/v1/report/feature/${featureId}/usage-history/${returnType}?sd=${startDate}&ed=${endDate}&granularity=${granularity}$(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 can be explained as follows.

ParameterRequiredTypeDescription
${featureId}Yesinteger

Specifies feature-specific parameters.

${returnType}YesstringSpecifies the format in which license usage data will be returned. The format can be one of the following: json, csv, xls, xlsx or pdf.
sdYesstringSpecifies the start date for which the report will be generated. The date is in YYYY-MM-DD format; for example, 2017-05-20.
edYesstringSpecifies the end date for which the report will be generated. The date is in YYYY-MM-DD format; for example, 2017-05-27.
granularityYesinteger

Specifies granularity of the returned data, which can be one of the following:

  • Quarter - 2
  • Month - 3
  • Week - 4
  • Day - 5
  • Hour - 6
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.

filterNojson/string

Applies filtering license usage data on all fields.

To filter by a string column, use the following format. 

[
	{ 
		"type": "string",
		"field": "lud",
		"value": "${value}"
	}
]

To filter by a numeric column, use the following format.

[
	{ 
		"type": "numeric", 
		"comparison": "${gt | lt | eq}", 
		"field": "${lumin | lua | lumax | lbmin | lbmax | ldtc | hu | ft}",
		"value": "${value}" 
	}
]


fieldsVisibilityNojson/string

Specifies field visibility settings, like this:

{ 
	"lud": "1", 
	"lumin": "1", 
	"lua": "1", 
	"lumax": "1", 
	"lbmin": "1", 
	"lbmax": "1", 
	"ldtc": "1", 
	"hu": "1", 
	"ft": "1"
}

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

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:

lud | lumin | lua | lumax | lbmin | lbmax | ldtc | hu | ft

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

{
	"success": ${success},
  	"msg": ${message},
  	"data": [
    	{
      		"fid": ${featureId},
      		"lud": ${date},
      		"lumin": ${minUsed},
      		"lua": ${averageUsed},
      		"lumax": ${maxUsed},
      		"lbmin": ${minBorrowed},
      		"lbmax": ${maxBorrowed},
      		"ldtc": ${denials},
      		"hu": ${hoursUsed},
      		"ft": ${total}
    	}
  	],
  	"code": ${code},
  	"totalCount": ${count}
}

where the response fields can be explained as follows.

FieldTypeDescription
successbooleanIndicates whether your API request was successfully processed.
msgstringError message returned on failure.
fidintegerFeature ID.
ludstring

Indicates period of time for which usage information is generated, i.e. date and time for hourly usage and dates for the remaining granularity options.

luminintegerMinimal licenses used count for a given date.
luafloatAverage licenses used count for a given date.
lumaxintegerMaximum licenses used count for a given date.
lbminintegerMinimal licenses borrowed count for a given date.
lbmaxintegerMaximum licenses borrowed count for given date.

ldtc

integerDenials count.
hufloatHours used.
ftintegerFeature total.
codeinteger

Error code if success equals false, null otherwise.

totalCountintegerTotal number of rows returned.

Obtaining information about usage history comparison for features

You can easily fetch metrics about usage history comparison for features by sending the following HTTP request.

GET /api/v1/report/feature/usage-history/comparison/json?fi=${featureIds}&sd=${startDate}&ed=${endDate}&granularity=${granularity}

There is also another, already deprecated, endpoint that you can use to fetch such metrics:

 GET /api/v1/report/usage-history/comparison/json?fi=${featureIds}&sd=${startDate}&ed=${endDate}&granularity=${granularity}

where the possible parameters are as follows:

ParameterRequiredTypeDescription
featureIdsYesarrayArrays of feature IDs in the following format: id1, id2, id3... for example fi=1,2,3,5.
sdYesstringSpecifies the start date for which the report will be generated in YYYY-MM-DD format; for example, 2017-05-20.
edYesstringSpecifies the end date for which the report will be generated in YYYY-MM-DD format; for example, 2017-05-27.
granularityYesinteger Specifies granularity of the returned data, which can be one of the following:
  • Quarter - 2
  • Month - 3
  • Week - 4
  • Day - 5
  • Hour - 6

Currently the report is only returned only in JSON syntax. There are plans to introduce CSV, XLS and PDF formats in the future.

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

{
	"success": ${success},
  	"msg": ${message},
  	"data": [
    	{
      		"fid": ${featureId_1},
      		"lud": ${date},
      		"lumin": ${minUsed},
      		"lua": ${averageUsed},
      		"lumax": ${maxUsed},
      		"lbmin": ${minBorrowed},
      		"lbmax": ${maxBorrowed},
      		"ldtc": ${denials},
      		"hu": ${hoursUsed},
      		"ft": ${total}
    	},
		{
      		"fid": ${featureId_2},
      		"lud": ${date},
      		"lumin": ${minUsed},
      		"lua": ${averageUsed},
      		"lumax": ${maxUsed},
      		"lbmin": ${minBorrowed},
      		"lbmax": ${maxBorrowed},
      		"ldtc": ${denials},
      		"hu": ${hoursUsed},
      		"ft": ${total}
    	}
  	],
  	"code": ${code},
  	"totalCount": ${count}
}

where the fields have the same values as the ones explained in Obtaining information about usage history for feature, above.

Obtaining information about usage history for license server

You can easily list all visible features for a given server by calling this HTTP GET request:

GET /api/v1/report/license-server/${lsid}/usage-history/${returnType}?sd=${startDate}&ed={endDate}&granularity=${granularity}$(additional parameters, as needed)

There is also another, already deprecated, endpoint that allows you to do just that:

GET /api/v1/report/usage-history/license-server/${lsid}/${returnType}?sd=${startDate}&ed={endDate}&granularity=${granularity}$(additional parameters, as needed)

where the possible parameters are as follows:

ParameterRequiredTypeDescription
${lsid}YesintegerLicense Server ID.
${returnType}YesstringSpecifies the format in which license usage data will be returned. The format can be one of the following: json, csv, xls, xlsx or pdf.
sdYesstring Specifies the start date for which the report will be generated. The date is in YYYY-MM-DD format; for example, 2017-05-20.
edYesstring Specifies the end date for which the report will be generated. The date is in YYYY-MM-DD format; for example, 2017-05-27.
granularityYesinteger Specifies granularity of the returned data, which can be one of the following:
  • Quarter - 2
  • Month - 3
  • Week - 4
  • Day - 5
  • Hour - 6
rnNostring 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.
filterNojson/string

Applies filtering license usage data on all fields.

To filter by a string column, use the following format. 

[
	{ 
		"type": "string", 
		"field": "${lud | fns | fv | ftype}",
		"value": "${value}"
	}
]

To filter by a numeric column, use the following format.

[
	{ 
		"type": "numeric", 
		"field": "${lumin | lua | lumax | lbmin | lbmax | ldtc | hu | ft}",
		"value": "${value}"
	}
]


fieldsVisibilityNojson/string

Specifies field visibility settings, for example:

{ 
	"lud": "1", 
	"lumin": "1", 
	"lua": "0", 
	"lumax": "1", 
	"lbmin": "1", 
	"lbmax": "1", 
	"ldtc": "1", 
	"hu": "0", 
	"ft": "0",
	"fns": "1",
	"fv": "1",
	"ftype": "1"
}

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

limitNointegerDetermines the maximum number of data records that can be returned. The value must be greater than zero.
offsetNointeger Specifies 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: 

lud | fns | fv | ftype | fid | lumin | lua | lumax | lbmin | lbmax | ldtc | hu | ft

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

orderDirectionNostring Determines 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.

{
	"success": ${success},
	"msg": ${message},
  	"data": [
    	{
      		"fid": ${featureId_1},
      		"lud": ${date},
      		"lumin": ${minUsed},
      		"lua": ${averageUsed},
      		"lumax": ${maxUsed},
      		"lbmin": ${minBorrowed},
      		"lbmax": ${maxBorrowed},
      		"ldtc": ${denials},
      		"hu": ${hoursUsed},
      		"ft": ${total},
			"fns": ${featureName},
			"ftype": ${featureType},
			"fv": ${featureVersion}
    	},
		{
      		"fid": ${featureId_1},
      		"lud": ${date},
      		"lumin": ${minUsed},
      		"lua": ${averageUsed},
      		"lumax": ${maxUsed},
      		"lbmin": ${minBorrowed},
      		"lbmax": ${maxBorrowed},
      		"ldtc": ${denials},
      		"hu": ${hoursUsed},
      		"ft": ${total},
			"fns": ${featureName},
			"ftype": ${featureType},
			"fv": ${featureVersion}
    	}
  	],
  	"code": ${code},
  	"totalCount": ${count}
}

where the response fields can be explained as follows.

FieldTypeDescription
successbooleanIndicates whether your API request was successfully processed.
msgstringError message returned on failure.
fidintegerFeature ID.
ludstringIndicates period of time for which usage information is generated, i.e. date and time for hourly usage and dates for the remaining granularity options.
luminintegerMinimal licenses used count for given date.
luafloatAverage licenses used count for given date.
lumaxintegerMaximum licenses used count for given date.
lbminintegerMinimal licenses borrowed count for given date.
lbmaxintegerMaximum licenses borrowed count for given date.

ldtc

integerDenials count.
hufloatHours used.
ftintegerFeature total.
codeintegerError code if success equals false, null otherwise.
totalCountintegerTotal number of rows returned.
fnsstringFeature name.
ftypestringFeature type.
fvstringFeature version.

If any of the requests has invalid or missing parameters, HTTP 400 BAD REQUEST is returned.

  • No labels