Web Service API Reference
The ScriptX.Services API controls printing, paper and printer settings, license registration and print job management. An OpenAPI (Swagger) specification is also available here which includes functionality to try out API calls to the MeadCo ScriptX.Services for Cloud server.
Many of the reference pages listed below include example code that runs on the page and allows API calls to be made to the MeadCo ScriptX.Services for Cloud> server, together with options to run the code against your own installations of both ScriptX.Services for On-Premise Devices and ScriptX.Services for Windows PC.
See how to download and install ScriptX.Services for Windows PC for more information on evaluating features.
Authentication
ScriptX.Services for Cloud and ScriptX.Services for Windows PC require that an authorization header be included in the HTTP request using Basic authentication with a user name of the subscription/license identifier and no password. For example:
headers = {
"Authorization" : "Basic " + btoa("13598d2f-8724-467b-ae64-6e53e9e9f644" + ":")
};
-
ScriptX Services for Cloud:
Basic authentication is used for all API calls with username of subscription identifier and no password. -
ScriptX Services for On Premise devices:
No authentication is used or validated by ScriptX.Services. -
ScriptX Services for Windows PC:
Basic authentication is used for all API calls with a username of the supplied publisher license identifier and no password.
API Reference (/api/v1)
Service Description
- (GET) - returns descriptive detail about the implementation of ScriptX.Services.
Licensing
- licensing (GET) - returns descriptive detail about the license in use (obtained from the authorization header)
- licensing (POST) - installs/updates a client-side license
- licensing/ping (GET) - used to check if ScriptX.Services is available (the call will succeed), or the options enabled for a license
Printer (requires v2.19 or later)
- printer/settings (GET) - returns the device settings for a print device HTML/PDF/RAW content will be printed to (paper size, source etc.)
- printer/current (GET) - returns the name of the system "current" print device - applies to ScriptX.Services for Windows PC only.
- printer/current (PUT) - sets the system "current" print device - applies to ScriptX.Services for Windows PC only.
- printer/connection (PUT) - adds a connection to a networked print device - applies to ScriptX.Services for Windows PC only.
- printer/connection (DELETE) - deletes a connection to a networked print device - applies to ScriptX.Services for Windows PC only.
PrintHtml
- printHtml/settings (GET) - returns the default settings for printing HTML content (headers, foooters, margins etc.)
- printHtml/deviceinfo (GET) - returns the device settings for a print device the HTML will be printed to (paper size, source etc.)
- printHtml/htmlPrintDefaults (GET) - returns the default settings for printing HTML, default device info and a list of available device names
- printHtml/print (POST) - sends HTML content to print using given HTML and device settings
- printHtml/status (GET) - gets the status of the print job with the given token
- printHtml/download (GET) - returns the PDF output for the print job with the given token
- printHtml/canceljob (PUT) - request that a job is cancelled (requires ScriptX Server 10.3 or later)
PrintPdf (requires v2.8 or later)
- printPdf/print (POST) - prints PDF document content with given PDF printing and device settings
- printPdf/status (GET) - gets the status of the print job with the given token
- printPdf/download (GET) - returns the PDF output for the print job with the given token
PrintDirect (requires v2.9 or later)
- printDirect/print (POST) - prints string content directly to a printer. This is useful in scenarious such as label printers using the ZPL language and can also be used to print PostScript.
Using ScriptX.Services for Windows PC with API sample code
An installer for the latest version (2.22.0.22) of ScriptX.Services for Windows PC can be downloaded using this button:
You will need Administrator rights to run the installer. Once installed, ScriptX.Services for Windows PC is available to any browser at any time. The default URL (as used in the API sample code) for the server is http://127.0.0.1:41191. If a certificate for localhost is available the server will also be available on https://localhost:41192.
For the sample code on these reference pages to function, an evaluation license must first be installed using the example code on the licensing (POST) reference page. The evaluation license can be used both for this site and for your own content delivered from your own localhost server. There are no specific requirements for your own content server on localhost - it may be IIS, Apache, Node, IIS Express etc etc.
Please note: unless you are running Chrome 70 or later or Edge 42 or later your browser will block calls to http:// from web pages delivered via https:// such as this website. In this case you will need to have a certificate for localhost installed so that the server will be available on https://localhost:41192. You should also change the URL for the sample code accordingly (entered values will be persisted between pages until the "Reset to default URL values" button is clicked).
For a detailed discussion on installation and configuration of ScriptX.Services for Windows PC please follow this link.
Also see our samples site for more detailed usage. An http:// version of the samples site is available here.