Let Oomnitza be your single source of truth!
Use the Zebra Send File to Printer workflow to send asset labels to a local printer.
Connect Oomnitza and Zebra in minutes
Get the information and insights you need by creating configurable workflows to simplify onboarding, such as creating a workflow to print asset labels.
About this workflow
This workflow uses the Zebra: Send File to Printer API to send a ZPL (Zebra Programming Language) script to a physical Zebra printer. The printer then prints a label (such as a barcode) that you can attach to your asset. For information on what a typical ZPL script looks like, see Labelary ZPL viewer.
Tip
You could run this workflow in conjunction with the ShipEngine Create Shipping label workflow which returns a ZPL file in the response.
Before you start
Before you can create the integration with Oomnitza, you need to have added your Zebra credentials to Oomnitza.
Make sure your ZPL printer is set up for the SendFileToPrinter API. You'll need to auto-generate a JSON file in the developer portal, replace it with your printer enrollment code, and send it to the printer.
You also need to get your Tenant ID so you can run the workflow. To get your Tenant ID complete the following steps:
- Navigate to the Zebra Savanna Tenant Service
- Click Authorize
- Add your Consumer Key to the ApiKeyAuth Section and click Authorize again.
- In the My Tenant section, click Try it out.
- Click Execute
Your Tenant ID is returned in the Account Number value.
[
{
"ownAccount": "true",
"AccountName": "user@oomnitza.com",
"AccountNumber": "1234567897"
}
]
Creating workflows
Follow the steps below to create a workflow using the Zebra Send File to Printer API.
1. Create the workflow
- Click Configuration > Workflows
- Click Add (+) and select Assets from the list.
2. Update the Begin block
Edit the Begin Block and add rules to trigger the workflow. For example, if you set the Actions to Schedule and add a rule so that the Status equals Active you can trigger a workflow to fetch an asset as soon as it becomes active. Make sure your Begin block criteria has adequate rules so that it does not print unwanted labels.
Refer to Using the Begin block.
3. Add an API block
- Drag and drop the API block onto the Sandbox.
- Click Edit on the API block and enter Zebra in the search field.
- Select the Zebra Send File to Printer preset. To choose the preset, click the forward arrow (>).
- Select the credentials that you created in Adding your Zebra credentials to Oomnitza.
-
Supply the following information:
- The Serial Number of the Printer you want to send the file to.
- The Tenant ID (also called the Account Number) you obtained in the previous steps.
- The ZPL content. Refer to the example below. For more examples see Labelary ZPL viewer.
^XA^FO10,20^A0,20^FDProperty of^FS^FO10,40^A0,40^FDOomnitza Inc.^FS
^FO10,90^BC,80,,,,^FDTG490T7QFT^FS^XZ
Important
If you enter line breaks in your ZPL content you may encounter 400 bad request errors. Refer to the Troubleshooting section for more information.
4. Add the API Response
-
Select the Response tab. Map the response by placing
{{response}}in the Response field and mapping it to a custom long text Oomnitza field, such as API Response. You should receive a{"status": SUCCESS}response when running these workflows. - Connect the Blocks.
- Save, validate, and activate your workflow.
Mapping the API Response
Example of a printed 128 barcode (for 1.5” x 1” label) printed using a ZEBRA ZD410 Direct Thermal Desktop Printer (with Ethernet). For a list of other supported printers refer to the Product Codes list in Printing Code 128 Barcode using ZPL
Troubleshooting
When using the API, you may encounter 400 bad request errors. This can occur if there are new lines in the message body.
Solution
To mitigate the risk of encountering 400 bad request errors, follow these recommendations:
- Avoid including new lines: Ensure that the message body does not include any new lines.
- Replace new lines with variables: If you need to keep the new lines for formatting purposes, you can replace them with variables in the message body. This method allows you to maintain the desired formatting while avoiding errors.
Procedure
1. Create a variable
- Select the Variables tab in the sidebar
.
- Click ADD VARIABLE.
- Enter LF as the variable name.
- Choose short text or long text as the Data Type
- Click Submit
2. Add an Update block
Insert an Update block before the API block
- Drag and drop the Update onto the sandbox.
- Edit the Update block
- Click Add field
- Select the LF variable you created from the field list and enter
{{"\r\n"}}as the value
3. Configure the API block body
- Edit the API block and go to Advanced Mode.
- Select the Body tab.
-
Add the variable to the new lines that appear in the ZPL content.
-
Click Add Metadata
- Select the LF variable you created in Step 1
-
Click Add Metadata
Important
Avoid manually adding the values \r\n as the API block automatically converts them to \\r\\n which can result in failure.
Related Documentation
Zebra: Send File to Printer API
Zebra GitHub Portal: Zebra Printer Samples
Zebra Developer Portal: Printer Setup for the SendFileToPrinter API
Comments
0 comments
Please sign in to leave a comment.