Introduction
The API is organized around REST. Our API has predictable resource-oriented URLs, and uses standard HTTP request verbs (GET, PUT, POST, DELETE). Most methods accept JSON-encoded request bodies and return JSON-encoded responses.
All URLs start with /api/{version}/ where {version} is currently v3, i.e. /api/v3/.
Authentication
TBD
Error handling
GSI uses conventional HTTP response codes to indicate the success or failure of an API request. In general: Codes in the 2xx range indicate success. Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a charge failed, etc.). Codes in the 5xx range indicate an error with the printer (these are rare).
Python client
Python is very useful to use and test the REST API because it has built-in support for both HTTP and JSON.
The following example will read and print the printer status:
import json, requests
rsp = requests.get('http://192.168.1.1/api/v3/status')
print(json.loads(rsp.content.decode()))
The following example selects a print job from the table "My Table":
import json, requests
rsp = requests.post(
url = 'http://192.168.1.1/api/v3/printJob',
headers = {'Content-Type': 'application/json'},
data = json.dumps(
{
'tableName': 'My Table',
'keyColumn': 'SKU',
'key': 'S12-342C',
'labelColumn': 'Label',
'labelName': 'MEDIUM',
'queue': True,
}))