NiceLabel REST Connector

This post is about how to connect a on premise NiceLabel server to Novacura Connect.

Assumptions

  • You have installed an agent somewhere locally
  • The server that the agent is installed on has access to the server in which NiceLabel is installed on
  • I used NiceLabel PowerForms Suite 3 printers product level Easy

Steps in Novacura Connect Build

  1. Create the connector by logging into https://build.novacura.com and navigating to the connectors page
  2. Fill out the information that will look something like this

Step in NiceLabel

NiceLabel Automation Builder

  1. Create and Unstructured Data filter

Structure

  • Create a file that can be used by NiceLabel i.e. C:\NiceLabel\TCPTrigger\payload.txt. Paste these contents into the file:
POST / HTTP/1.1
Host: nicelabel-server:44444
Content-Type: text/plain; charset=utf-8
Content-Length: 53

LabelForPrinting.nlbl
PrinterName
1
PARTNUMBER
  • Add four Fields and name them each the variable to be used later on
  • For each field, map them the the line in the file that will correlate to said variable
  • Save the filter
  1. Create a new TCP/IP Server trigger

Settings

General

  • Give it a memorable name like TCP/IP Server Novacura
  • Port: 44444 (use this in the connector Base URL port
  • Deselect “On client disconnect” and check “if nothing is received after the specified time interval”
  • Change time interval to “2 s”

Other

  • Check the box "Save data received by the trigger to file
  • Make the file path to somewhere readable by NiceLabel i.e. C:\NiceLabel\TCPTrigger\payload.txt

Variables

image

Depending on how your label format is configured and/or how you are going to convert your Novacura Flow Connect variables to send to the label, this section will vary widely and will need to be changed. For my setup and label format, I needed four variables for the label and two additional for Novacura HTTP request call.

  • Error
  • FORMAT
  • PartNumber
  • PRINTER
  • QUANTITY
  • ReturnMessage

Actions

  1. From the All Actions option, choose “Open Document/Program”

  2. Make the file name the same as used above i.e. C:\NiceLabel\TCPTrigger\payload.txt

  3. Add a Use Data Filter

  4. Select your unstructured data filter

  5. Map the field names to your variables

  6. Add Open Label

  7. Use Data source and select in this example FORMAT

  8. Add Set Printer

  9. Use Data source and select in this example PRINTER

  10. Add Print Label

  11. Use Data source and select in this example QUANTITY

  12. Then from All Actions, choose “Send Data to TCP/IP Port”

  13. Check Reply to sender

  14. Under the Content section in the Data: field, paste the following

HTTP/1.1 200 OK
Accept-Ranges: bytes
Content-Type: application/json
Content-Length: 21

{"message":"success"}
  1. Save the trigger

Steps in Novacura Connect Build App

Now to actually call the rest connector.

  1. Create a script step that will house all your variables in a single text variable and separate each variable with a carriage return
let cr       = chr(13) & chr(10);
let printtxt = FORMAT & cr & PRINTER & cr & QUANTITY & cr & PartNumber;
return printtxt;
  1. Create a HTTP request element
  2. In the “Request Body” tab, choose the variable from the script step
  3. In the “Response Handling” tab, paste in the following
{
    message: text
}


You are ready to test!

I hope this post has been helpful to others.

3 Likes

Excellent tutorial! Thank you.

thanks for sharing :slight_smile:

Thanks for the feedback! :hugs: