licensing (GET)
{server}/api/v1/licensing
Description
Returns descriptive detail about the license in use (obtained from the authorization header).
Applies to:
- ScriptX.Services for Cloud
- ScriptX.Services for On-Premise Devices (Authorisation header is ignored)
- ScriptX.Services for Windows PC
Response model
License {
guid (string, optional),
company (string, optional),
companyHomePage (string, optional),
from (string, optional),
to (string, optional),
options (LicenseOptions, optional),
domains (Array[string], optional)
}
LicenseOptions {
basicHtmlPrinting (boolean, optional),
advancedPrinting (boolean, optional),
enhancedFormatting (boolean, optional),
printPdf (boolean, optional),
printRaw (boolean, optional)
}
License:
- guid (string, optional)
- Confirms the license identifier GUID as sent (encoded) in the request Authorisation header.
- company (string, optional)
- Name of the company or organisation to whom this license is assigned.
- companyHomePage (string, optional)
- URL of company or organisation website home page.
- from (string, optional)
- Start date of license in ISO date-time format eg. 2017-02-23T00:00:00+00:00.
- to (string, optional)
- End date of license in ISO date-time format eg. 2017-02-23T00:00:00.
- options (LicenseOptions, optional)
- Options for this license as defined by the LicenseOptions class.
- domains (Array[string], optional)
- Domains for which this license is valid. Only requests from licensed domains will be processed by the ScriptX.Services server.
LicenseOptions:
- basicHtmlPrinting (boolean, optional)
- Indicates whether the license (as specified in the request Authorisation header) is valid for basic HTML printing.
- advancedPrinting (boolean, optional)
- Indicates whether the license (as specified in the request Authorisation header) is valid for advanced printing options.
- enhancedFormatting (boolean, optional)
- Indicates whether the license (as specified in the request Authorisation header) is valid for enhanced formatting options.
- printPdf (boolean, optional)
- Indicates whether the license (as specified in the request Authorisation header) is valid for printing PDF documents.
- printRaw (boolean, optional)
- Indicates whether the license (as specified in the request Authorisation header) is valid for direct (RAW) printing.
Example usage
Request
<h5>Response <span id="response-status"></span></h5>
<textarea id="response" readonly="readonly" rows="3" class="codefont"></textarea>
<h5>Response headers</h5>
<textarea id="headers" readonly="readonly" rows="3" class="codefont"></textarea>
$(function () {
$('#btn_runcode').click(function () { callServer(); });
});
function callServer() {
$('#response-status').text("(waiting)");
var settings = {
method: "GET",
dataType: "json",
jsonp: false,
cache: false
};
settings.headers = { "Authorization": "Basic "
+ btoa("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + ":") };
jQuery.ajax("/api/v1/licensing", settings)
.done(function (data, textStatus, jqXHR) {
$('#response-status').text(('(status: ' + jqXHR.status + ' ' + jqXHR.statusText + ')'));
$('#response').val(JSON.stringify(data, null, " ")); // shows JSON response in textarea element
$('#headers').val(jqXHR.getAllResponseHeaders()); // shows response headers in textarea element
// do something with the license information
var licenseGuid = data.guid;
var isEnabledForAdvancedPrinting = data.options.advancedPrinting;
var printingLicensedForThisDomain = false;
for (i = 0; i < data.domains.length; i++)
{
if (data.domains[i] === window.location.hostname)
{
printingLicensedForThisDomain = true;
break;
}
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
$('#response-status').text('(status: ' + jqXHR.status + ' ' + jqXHR.statusText + ')');
});
}