API

barxui includes a programmers interface (API) to low level functionality that allows integration of custom applications. Using the API you can:

  • List various objects such as Labels, Printers & Agents
  • Print 1 or more labels to PDF, PNG or to a printer via an installed Agent

Using the API you can:

  • print without providing any data – labels can use :
    • static values
    • variables that calculate values (e.g. current date/time)
    • sequence and serial number
  • print proving values for prompted variable values that are normally entered by a user via the user interface, e.g. an operator name or batch number etc.
  • print using data from a barxui table, optionally providing query parameters
  • print providing all the data for 1 or more labels
  • and more…

Examples and instructions for all these use cases follows below. The detailed API

Before using the API:

  • Optionally upload a data file from CSV or Excel
  • Create one or more label designs
  • Optionally install an Agent
  • Install the API AddOn
  • Activate the API interface and generate an API Key
Settings & Organisation Settings & API Key & click Create API Key.

Note: During the trial period of your subscription you will have limited access to the API and other functionality in barxui.

Listing Labels

The API provides and endpoint to list all the available labels.

Fetch a single label (including its inputs, queryParameters, and fields) via GET label/{id} — you’ll need this before printing, since it tells you what the label expects.

Designing Labels for API Access

The design of your labels depends on your use case.

Static Labels

This is the most basic mode for labels. All shapes on the label are static – i.e. their values do not derive from any data or variable expressions.

Using the API you can print these labels without any inputs, query parameters or data elements in the request.

Data-Driven Labels

Labels connected to a barxui table (see Label Data) can be printed in two ways via the API: supply the data yourself in the data property of the print request, or let barxui fetch matching rows using queryParams — a dictionary matched against the label’s query parameters, with wildcards supported (e.g. “widget*”).

Prompted / Input Labels

Some labels include Prompted Question variables — values that are normally typed in by whoever is printing, such as an operator name or batch number. When fetching a label, these appear in its inputs list. Supply matching values in the input property of the print request; required inputs must be provided, though the value itself can be blank.

Making Requests

All requests go to https://api.barxui.com/api/v2 and must include an Authorization: Token <API KEY> header plus Accept: application/json. Any request returning more than one item comes back as a PagedResponse with values, page, pageSize, totalItems, and totalPages.

Other Endpoints

  • Agent — POST agent/list and GET agent/{id} list the barxui Agents connected to your organisation (name, host, install date, version).
  • Printer — GET printer/list returns the printers available through your connected Agents (file outputs like PDF/PNG aren’t listed here — use outputMode instead).
  • Print — POST print sends a PrintRequest with a labelId and either a printerId (outputMode: PRINT) or file settings (outputMode: PDF or PNG). See Print Requests below.

Print Requests

Example — print to a physical printer via an Agent:

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "labelId": "123e4567-e89b-12d3-a456-426614174000",
  "data": {
    "name": "John Doe",
    "address": "123 Main St",
    "city": "Anytown",
    "state": "CA",
    "zip": "12345"
  },
  "outputMode": "PRINT",
  "outputParameters": {
    "printerId": "123e4567-e89b-12d3-a456-426614174000",
    "copies": 1
  }
}

Samples & Support

Full reference documentation and a working .NET (C#) sample tool are maintained in the barxui-api repository on GitHub.

For help with the API, contact support@barxui.com or log an issue in the barxui-api repository.