Below you see a list of the APIs for printers in InterformNG2. APIs are introduced here.
This returns a list with the names of all printers that are installed on the O/S on the InterformNG2 host machine.
GET <NG2_URL>/restapi/v1/systemPrintersInput: N/A
JSON example output:
{
"systemPrinterNames": [
"OneNote (Desktop)",
"ZDesigner ZD500R-203dpi ZPL",
"OneNote for Windows 10",
"Microsoft XPS Document Writer",
"Microsoft Print to PDF",
"HPLJ500C (HP LaserJet 500 color M551)",
"Fax"
]
}This returns a list of all the printers that have been configured in the InterformNG2 settings.
GET <NG2_URL>/restapi/v1/printersInput: N/A
JSON example output:
{
"printers": [
{
"type": "system",
"id": "InterForm",
"dpi": 300,
"mimeType": "application/vnd.hp-PCL",
"remoteOutput": false,
"systemPrinterName": "HP 500-2"
},
{
"type": "socket",
"id": "PDF Printer",
"dpi": 300,
"mimeType": "application/pdf",
"remoteOutput": false,
"printerAddress": "localhost"
},
{
"type": "system",
"id": "ZDesigner",
"dpi": 300,
"mimeType": "x-application/zpl",
"remoteOutput": false,
"systemPrinterName": "ZDesigner ZD500R-203dpi ZPL"
}
]
}id is the unique id of the printer configuration entry. This field matches "name" in the settings UI. Note that the same physical printer can have multiple configuration entries.
type indicates the printer configuration type.
mimeType is the document type that the printer accepts (as generated by an InterformNG2 workflow).
Some printers have advanced settings that are not part of the output in the list above. This request will return all settings values for a specific printer id.
GET <NG2_URL>/restapi/v1/printers/<id>Input: <id> in the URL must be replaced with the id of the specific printer (as seen in the list above).
JSON example output:
{
"printer": {
"type": "system",
"id": "ZDesigner",
"dpi": 300,
"mimeType": "x-application/zpl",
"remoteOutput": false,
"advanced": {
"ct": "~",
"cc": "^",
"cd": ",",
"startWithFonts": true
},
"systemPrinterName": "ZDesigner ZD500R-203dpi ZPL"
}
}Typical HTTP error codes:
404: The requested id was not foundPOST <NG2_URL>/restapi/v1/printers/Input: The body of the request must be the printer configuration to add, including the desired id.
The following input fields are available. Some are only relevant for a specific printer type:
Field | Printer type | Data type | Description |
type | all | string (mandatory) | The type of printer configuration. Valid values: system, socket, ipp, lpd, preview, smb |
id | all | string (mandatory) | The unique id (name) of the new printer configuration entry. Must be different from existing ids. |
dpi | all | integer (mandatory) | The DPI of the printer. |
mimeType | all | string (mandatory) | The document type that the printer exists. Valid values: |
remoteOutput | all | boolean | If the printer is connected via a remote output client. |
remoteLocation | all | string | If remote output is "true", then this must be the location id of the remote output client. |
useQueue | all | boolean | States if the print queue manager is to be used. |
location | all | string | Location field. Can be used for describing the location of the printer. |
description | all | string | The description field of the printer. |
group | all | string | The ID of the group, that the printer is included in. |
advanced | all | object | Advanced settings for the specific mime type (see below) |
systemPrinterName | system | string | The name of the printer on the O/S (as listed by "list system printers name" unless it is on a remote output client) |
outputQueue | system | string | For IBM i installations only, the output queue of the printer. |
outputLib | system | string | For IBM i installations only, the output queue library of the printer. |
uri | ipp | string | URI of the printer |
username | ipp, smb | string | User name to use when connecting to the printer |
password | ipp, smb | string | Password to use when connecting to the printer |
printerAddress | socket, lpd, preview | string | The IP address of the printer. |
shareName | lpd | string | The share name of the printer |
port | preview | integer | The network port of the preview printer |
uncPath | smb | string | The full UNC path to the printer |
domain | smb | string | The domain used for signing on to the printer. |
The advanced object can have the following fields. Each mimeType has its own set of valid fields.
Field | Mime type | Data type | Description |
pclCommands | application/vnd.hp-PCL | string | Additional PCL commands to add in the beginning of the PCL document. |
pjlCommands | application/vnd.hp-PCL | string | Additional PJL commands to add in the beginning of the PJL document. |
| includeStandardFonts | application/vnd.hp-PCL | boolean | Set true if standard fonts should be sent to the printer with the print job. |
| fillUsingRaster | application/vnd.hp-PCL | boolean | Set true if InterformNG2 should convert grayscale to black&white instead of letting the printer do it. |
| fullColor | application/vnd.hp-PCL | boolean | Set true to print in color, false for black&white. |
| compressColorImages | application/vnd.hp-PCL | boolean | True to compress color images with run-length compression. Only relevant when fullColor = true |
| ct | x-application/zpl | string (1) | The character to use as ct in ZPL |
| cc | x-application/zpl | string (1) | The character to use as cc in ZPL |
| cd | x-application/zpl | string (1) | The character to use as cd in ZPL |
| startWithFonts | x-application/zpl | boolean | Include fonts definition on each page. |
| fonts | x-application/direct-protocol | string[] | Array of font names for fonts already installed on the printer |
| images | x-application/direct-protocol | string[] | Array of image names for images already installed on the printer |
JSON example input:
{
"type": "ipp",
"id": "NewIPP",
"dpi": 300,
"mimeType": "application/vnd.hp-PCL",
"remoteOutput": false,
"advanced": {
"fullColor": true,
"compressColorImages": true
},
"uri": "192.192.100.100",
"username": "Default",
"password": "password"
}Output: In case of successful operation, no response body is returned. In case of error, the standard error body is returned.
Typical HTTP error codes:
403: The requested id already exists
The Add new printer configuration request above creates one printer per POST request. To create many printers automatically, you can use the Postman Collection Runner. Postman then runs the same POST request once for each item in a JSON data file, so you can add all your printers in a single run.
The process has four main parts: prepare a JSON data file, prepare the POST request body with variables, run the request from the Collection Runner.
Create a local file, for example printers.json. The file must be a valid JSON array. Each object in the array represents one printer and one iteration in Postman.
[
{
"type": "system",
"id": "My printer1",
"dpi": 300,
"mimeType": "application/vnd.hp-PCL",
"remoteOutput": false,
"systemPrinterName": "My printer1",
"outputQueue": "My printer1",
"outputLib": "myOut"
},
{
"type": "system",
"id": "My printer2",
"dpi": 300,
"mimeType": "application/vnd.hp-PCL",
"remoteOutput": false,
"systemPrinterName": "My printer2",
"outputQueue": "My printer2",
"outputLib": "myOut"
}
]Each id must be unique.
Important: do not paste this array into the request Body. This file is selected later in the Collection Runner as the data file.
Open the POST request in Postman and set Body → raw → JSON. The body must contain one JSON object only. Use Postman variables with the same names as the fields in the data file.
{
"type": "{{type}}",
"id": "{{id}}",
"dpi": {{dpi}},
"mimeType": "{{mimeType}}",
"remoteOutput": {{remoteOutput}},
"systemPrinterName": "{{systemPrinterName}}",
"outputQueue": "{{outputQueue}}",
"outputLib": "{{outputLib}}"
}Save the POST request inside a Postman collection or folder. For bulk execution, place only the required POST request in a separate folder, or make sure only that request is selected in the Runner.
Open the collection or folder in Postman and choose Run. Then:
The preview should show one row per iteration and columns matching the variable names used in the request Body. If the preview looks correct, start the run.
After the run finishes, Postman displays the result for each iteration. Open each failed iteration to review the Response and Request tabs. The Request tab shows the exact JSON body that Postman sent to the API.
Check | Expected result |
Data file format | Valid JSON array: [ { ... }, { ... } ] |
Request Body | One JSON object with {{variables}}, not the full array |
Variable names | Names in Body match the field names in the JSON file |
Runner selection | Only the required POST request is selected |
Iterations | Same number as objects in the JSON file |
Authentication | Token is configured |
In this example the endpoint creates one printer per POST request. The same pattern can be reused for other endpoints that accept one object per request.
PATCH /restapi/v1/printers/<id>Input: <id> in the URL must be replaced with the id of the specific printer.
The body of the request must be the printer configuration settings that should be modified/added on the specific printer configuration.
The body should only include the fields that are modified. The fields not listed in the update will retain their previous value.
The fields of the body payload are the same as when adding a new printer, but note that it is not possible to change the printer type in an update.
JSON example input:
{
"dpi": 600,
"advanced": {
"includeStandardFonts": true
},
"uri": "192.192.100.110"
}DELETE /restapi/v1/printers/<id>Input: <id> in the URL must be replaced with the id of the specific printer.
The settings for this printer will be deleted.
POST <NG2_URL>/restapi/v1/printerGroup/Input:
Field | Data type | Description |
id | string | ID of the new printer group |
| location | string | Location of the printer group |
| description | string | Description of the printer group |
Existing printers can be added to the group using PATCH /restapi/v1/printers/{id}
DELETE <NG2_URL>/restapi/v1/printerGroup/{id}By default the printers in the group are not deleted but are only ungrouped. A query parameter can be used to specify that the printers in the group should be deleted instead.
Field | Data type | Description |
id | string | ID of the new printer group |
| deletePrinters | boolean | Delete all printers in the group. Default false. |