licensing (POST)
{server}/api/v1/licensing
Description
Install/update a client-side license for ScriptX.Services for Windows PC. If sent to ScriptX.Services for Cloud or ScriptX.Services for On-Premise Devices, request parameters are ignored and the license details for the already installed license will be returned.
See also the OpenAPI (Swagger) definition.
No authorization header is required for this API call.
Applies to:
- ScriptX.Services for Windows PC
Request parameters
ClientLicense {
guid (string, optional),
url (string, optional),
revision (integer, optional)
}
ClientLicense:
- guid (string, optional;)
- The Guid for the license to be installed or updated.
- url (string, required)
- Location of the license. If the value "warehouse" is used the MeadCo license service is contacted for the license.
- revision (integer, optional)
- Revision number of the license to be installed.
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 installed or updated.
- 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
<script type="text/javascript">
const requestData = {
"guid": "3cfd70e2-f38f-4ab2-95f4-4ce4c1e39497",
"url": "warehouse",
"revision": 0
};
const servicesLocalURL = "http://127.0.0.1:41191";
fetch(`${servicesLocalURL}/api/v1/licensing`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(requestData)
})
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
}
return response.json();
})
.then(data => {
// do something with the response license information
const printingLicensedForThisDomain = data.domains.some(domain => domain === window.location.hostname);
if (printingLicensedForThisDomain) {
console.log("Printing is licensed for this domain.");
} else {
console.log("Printing is not licensed for this domain.");
}
})
.catch(error => {
console.error('There has been a problem with your fetch operation:', error);
});
</script>