HTTP API
Virtual Printer speaks two protocols, and it matters which one does what.
- HTTP/REST — create workspaces and printers, read parsed documents back, inject hardware faults,
subscribe to event streams. Everything under
/api. - Raw TCP — the printing itself. A client opens a socket to
settings.publicHostonsettings.tcpListenPortand writes ESC/POS or EPL bytes. This step is deliberately not HTTP and is therefore not in the OpenAPI spec.
A test or integration normally uses both: HTTP to set the printer up and to assert on the result, raw TCP in between for the part that must behave like real hardware.
Reference
- Endpoint reference — every endpoint with its request and response shapes, the
problem+jsonerror map, the SSE streams, and the full end-to-end scenario. - Printer status API — start/stop, operational flags, cash drawer, and status streaming in detail.
- CI/CD and automated tests — the same endpoints arranged as a test workflow.
OpenAPI
A live spec is generated from the controllers and served by the application itself:
- Swagger UI:
/swagger - Raw spec:
/swagger/v1/swagger.json
It covers the HTTP surface only, for the reason above.
Conventions worth knowing up front
- JSON is PascalCase (
Token,AccessToken,Id). - Null properties are omitted from responses, with one deliberate exception:
Printer.LastDocumentReceivedAtis always present and may benull. - IDs for workspaces and printers are supplied by the caller as GUIDs, which makes creates easy to assert against and re-run.
- Every authorized endpoint takes
Authorization: Bearer <AccessToken>fromPOST /api/auth/login.