Savanna printing can't associate template with printer

// Expert user has replied.
H Hussain Hussain 2 years 2 months ago
1 12 0

Hello,

We are using https://api.zebra.com/v2/devices/printers to register a Zebra printer and then added a ZPL template. But when we try to print using the api, we are getting an error back - "Template not found associated with printer "

Is there a way I can log in to Savanna and see an admin panel or something similar to see the registered printers, templates and associations?

If not, how do I go about troubleshooting this issue?

Thank you!

Please register or login to post a reply

12 Replies

S Steven Si

The SendFileToPrinter API (endpoint: https://api.zebra.com/v2/devices/printers/send) just sends a file to a printer. It's a REST request and unidirectional. The file sent by this API can be a label format file (ZPL) to print a label, a template file (ZPL Store Format or XML Store Format to be called by the Recall Format sent to the printer later) that is to be stored on the printer, etc.

Where does this "Template not found associated with printer" error come from? It doesn't look like it comes from the response of the REST request.

H Hussain Hussain

Thank you for your response. I have just taken on an existing project with no prior knowledge of Zebra or Savanna products and APIs, so pardon my ignorance. Is there a documentation for the Savanna APIs and what request and response objects it expects/returns so I can better understand this?

S Steven Si
H Hussain Hussain

Thank you very much!

Is there a way to pass the ZPL template as a string instead of a ZPL file?

S Steven Si

It has to be a file or a file object. The SendFileToPrinter API doesn't take string.

H Hussain Hussain

I see. In this documentation - https://developer.zebra.com/apis/sendfiletoprinter-model#/SendFileToPri…
it does not mention anything about the actual values that need to be passed in for printing?

Same with the example here- https://developer.zebra.com/blog/use-sendfiletoprinter-api-your-cloud-b…

S Steven Si

As the name of the SendFileToPrinter API indicates, this API sends a FILE to a printer. Here is the screenshot of the API documentation about what are required in the body of the HTTPS multipart POST request.

H Hussain Hussain

Thank you. I am still not 100% of what type of file is accepted as valid by the api.

I tried sending in a zpl template file that we use for our label printing and I got this error back from the api -

{"fault":{"faultstring":"Execution of JS-ExtractPrinterList failed with error: Javascript runtime error: \\"TypeError: Cannot read property \\"1\\" from null. (JS-ExtractPrinterList.js:7)\\"","detail":{"errorcode":"steps.javascript.ScriptExecutionFailed"}}}

Does this tell you what I might be doing wrong?

S Steven Si

The error msg indicates that the backend server cannot parse the request body, which means there are something wrong with the format of the request body. Please follow the instructions in the Test Print section of this article - Use the SendFileToPrinter API for Your Cloud-Based Printing Needs, and make sure you are able to print a simple ZPL label in the HelloWorld.txt (containing the ZPL of ^XA ^FO50,50^ADN,36,20^FDHello World^FS ^XZ) first by using the Curl commands at the command line, in order to get a sense on what is required in what format.

H Hussain Hussain

Hi again,

I tried the exact zpl contents as that file and still got the same error. I am passing in the apikey, tenant and sn as well along with the zpl-file.

I need to be able to troubleshoot the error so I know what part of my request is having trouble being parsed at your end.

S Steven Si

Could you provide some details about how the request is composed and what tool or programming language is used, so as to help to diagnose? Without the details, we cannot troubleshoot. The three online documents provided early contain the information we need to make a successful call.

H Hussain Hussain

Just to make things clear.
I am Hussain and I apologize for the repeated questions. This thread has been generated by a colleague of mine. He used this account in my vacation.
The API and the endpoint are working fine.
We are able to print thousands of lables daily.
@Dave, please use a separate account for experimental questions
Thank you.
Hussain

CONTACT
Can’t find what you’re looking for?