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>
document.addEventListener("DOMContentLoaded", function() {
document.getElementById('btn_runcode').addEventListener('click', function() { callServer(); });
});
function callServer() {
document.getElementById('response-status').textContent = "(waiting)";
const apiUrl = "/api/v1/licensing";
const headers = new Headers({
"Authorization": "Basic " + btoa("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + ":"),
"Content-Type": "application/json"
});
fetch(apiUrl, { method: "GET", headers: headers })
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok: ' + response.statusText);
}
document.getElementById('response-status').textContent =
'(status: ' + response.status + ' ' + response.statusText + ')';
return response.json().then(data => {
// show JSON response in textarea element
document.getElementById('response').value = JSON.stringify(data, null, " ");
// 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;
}
}
return response.headers;
});
})
.then(headers => {
// show response headers in textarea element
let headersText = "";
for (let pair of headers.entries()) {
headersText += `${pair[0]}: ${pair[1]}\n`;
}
document.getElementById('headers').value = headersText;
})
.catch(error => {
document.getElementById('response-status').textContent = '(error: ' + error.message + ')';
document.getElementById('response').value = "Failed to fetch data.";
});
}