Using JSON format to query and configure QLn and iMZ series mobile printers

Article ID: 99080064

Details


 

Topic or Information

Using JSON format to query and configure QLn and iMZ mobile printers

Applies To

QLn220, QLn320, QLn420, iMZ220, iMZ320

JavaScript Object Notation

Details

JSON (JavaScript Object Notation) is an open standard format that uses human-readable text to transmit data objects consisting of elements as attribute–value pairs. It is used primarily in real world applications to transmit data between a server and web application.

 
For our purposes JSON can be used as an alternative to using the SGD (Set-Get-Do) mechanism when reading or writing parameters on QLn and iMZ Zebra mobile printers. JSON is a popular open standard for exchanging data objects and is well suited to this task. 
 
All JSON commands should follow the JSON specification for escaping, spacing, etc.  Read More>>
All JSON commands are prefixed by {}.
 
To get an SGD value:
{} {"sgd.name": null}
Returns:
{"sgd.name":"value"}
 
To set an SGD value:
{} {"sgd.name":"new_value"}
This will return the value that was set, or the old value if the set failed:
{"sgd.name":"new_value”}
 
To get an SGD branch:
{} {"bluetooth":null}
Returns:
All SGDs in branch and their values
 
To get all the SGDs and their values along with various other information including defaults:
{} {"allconfig":null}
  
JSON is available on all communications ports, unless line_print is enabled, in which case you must use the main TCP JSON port, 9200.  If you connect to port 9200 the printer ONLY accepts JSON commands (CPCL, SGD, ZPL, etc. are not supported)