licensing/ping (GET)
{server}/api/v1/licensing/ping[?licenseGuid={guid}]
Description
Used to check if ScriptX.Services is available (the call will succeed whether or not the licenseGuid parameter is specified). If licenseGuid is specified and matches an installed license (ScriptX.Services for Windows PC) or valid subscription identifier (ScriptX.Services for Cloud) the options enabled for the license/subscription are returned.
No authorization header is required for this API call.
Applies to:
- ScriptX.Services for Cloud
- ScriptX.Services for On-Premise Devices (licenseGuid parameter is ignored)
- ScriptX.Services for Windows PC
Response model
LicenseOptions {
basicHtmlPrinting (boolean, optional),
advancedPrinting (boolean, optional),
enhancedFormatting (boolean, optional),
printPdf (boolean, optional),
printRaw (boolean, optional)
}
LicenseOptions:
- basicHtmlPrinting (boolean, optional)
- Indicates whether the license (as specified in the optional licenseGuid parameter) is valid for basic HTML printing.
- advancedPrinting (boolean, optional)
- Indicates whether the license (as specified in the optional licenseGuid parameter) is valid for advanced printing options.
- enhancedFormatting (boolean, optional)
- Indicates whether the license (as specified in the optional licenseGuid parameter) is valid for enhanced formatting options.
- printPdf (boolean, optional)
- Indicates whether the license (as specified in the optional licenseGuid parameter) is valid for printing PDF documents.
- printRaw (boolean, optional)
- Indicates whether the license (as specified in the optional licenseGuid parameter) 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/ping";
const headers = new Headers({
"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 isEnabledForAdvancedPrinting = data.advancedPrinting;
var isEnabledForEnhancedFormatting = data.enhancedFormatting;
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.";
});
}