Раздел API
Этикетки
Этикетки и ценники по шаблонам: просмотр картинкой и печать на принтер этикеток.
| POST | /api/v1/labels/{name}/render | Подставить данные |
| POST | /api/v1/labels/{name}/print | Напечатать этикетку |
| GET | /api/v1/labels | Шаблоны этикеток |
| GET | /api/v1/labels/{name} | Шаблон этикетки |
Подставить данные#
POST
/api/v1/labels/{name}/renderТекст команд с подставленными полями — посмотреть, что уйдёт на принтер; не печатает
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
nameобязательный | path | string |
Тело запроса application/json
Тип: словарь → string
JSON
{
"key": "string"
}Ответ 200 application/json
Поля · Rendered
textstring
Ошибки — problem+json с полем code, см. коды ошибок.
Пример запроса
curl
curl -X POST 'http://localhost:7790/api/v1/labels/PRICE/render' \
-H 'Content-Type: application/json' \
--data '{"key":"string"}'curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/labels/PRICE/render' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Content-Type: application/json' \
--data '{"key":"string"}'Шаблон с данными — на принтер без драйвера (device) или принтер Windows в режиме RAW
Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
nameобязательный | path | string | |
Idempotency-Keyобязательный | header | string | |
Prefer | header | string |
Тело запроса application/json обязательное
Поля · LabelPrintRequest
dataсловарь → stringdeviceinteger int32printerstringrolestringcopiesinteger int32от 1до 100
JSON
{
"data": {
"key": "string"
},
"device": 1,
"printer": "string",
"role": "string",
"copies": 1
}Ответ 200 application/json
Поля · Operation
idstring uuidtypestringidempotencyKeystringresourcesмассив stringstatusstringзначения:QUEUEDRUNNINGSUCCEEDEDFAILEDUNKNOWNstagestringcreatedAtstring date-timestartedAtstring date-timefinishedAtstring date-timeresultлюбое значениеerrorOperationError3 поля · OperationError
codestringmessagestringdetailsлюбое значение
warningsмассив string
Ошибки — problem+json с полем code, см. коды ошибок.
Пример запроса
curl
curl -X POST 'http://localhost:7790/api/v1/labels/PRICE/print' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"data":{"key":"string"},"device":1,"printer":"string","role":"string","copies":1}'curl
curl -X POST 'https://cloud.hw-connector.ru/agent/api/v1/labels/PRICE/print' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42' \
-H 'Idempotency-Key: $(uuidgen)' \
-H 'Prefer: wait=30' \
-H 'Content-Type: application/json' \
--data '{"data":{"key":"string"},"device":1,"printer":"string","role":"string","copies":1}'Шаблоны этикеток#
GET
/api/v1/labelsГотовые примеры агента (ZPL, TSPL, EZPL, ESC/POS) и свои шаблоны из data/labels
Ответ 200 application/json
Массив · Label
namestringtitlestringlanguagestringзначения:ZPLTSPLEZPLESCPOScharsetstringdescriptionstringbodystringsampleсловарь → stringbuiltInbooleanfieldsмассив string
Ошибки — problem+json с полем code, см. коды ошибок.
Пример запроса
curl
curl 'http://localhost:7790/api/v1/labels'curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/labels' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'Шаблон этикетки#
GET
/api/v1/labels/{name}Параметры
| Имя | Где | Тип | Описание |
|---|---|---|---|
nameобязательный | path | string |
Ответ 200 application/json
Поля · Label
namestringtitlestringlanguagestringзначения:ZPLTSPLEZPLESCPOScharsetstringdescriptionstringbodystringsampleсловарь → stringbuiltInbooleanfieldsмассив string
Ошибки — problem+json с полем code, см. коды ошибок.
Пример запроса
curl
curl 'http://localhost:7790/api/v1/labels/PRICE'curl
curl 'https://cloud.hw-connector.ru/agent/api/v1/labels/PRICE' \
-H 'X-Api-Key: hwk_…' \
-H 'X-Device-Id: 42'