Print

This page provides a full description of all the routes available for handling printers. Each route is explained with its parameters, required headers, possible responses and examples of use.

➡️ Create a print job

➡️ Get print job status

💡 Models

PrintJobContent

Parameter
Type
Explanation
Mandatory

commands

It's an array of PrintcommandType, it can contain a type TextPrintCommand | CutPrintCommand | FeedPrintCommand. Each line doesn't have to have the same type. More explanations below with the example here.

type

string

Use the value "epos".

PrintCommandType

TextPrintCommand

Parameter
Type
Explanation
Mandatory

type

string

Use the value "text".

lang

string

Text langage.

smooth

boolean

Enables or disables anti-aliasing (smoothing) to improve text sharpness.

x

number

Horizontal position of the text (X coordinate).

align

Alignment of the text (left, right, center).

value

string

The text content to be printed.

width

number

Width of the text line (integer values only, 1 or 2).

height

number

Height of the text line (integer values only, 1 or 2).

reverse

boolean

Inverts the text colors (negative mode).

ul

boolean

Enables or disables underline for the text.

em

boolean

Enables or disables emphasis (bold or italic depending on the implementation).

color

string

Text color (CSS color value or other supported format).

PrintAlign Enum

Value
Explanation

left

Align left.

center

Align center.

right

Align right.

CutPrintCommand

Parameter
Type
Explanation
Mandatory

type

string

Use the value "cut".

typetype

string

Use the value "feed".

value

string

Optional value that might provide additional information or metadata related to the cut command.

FeedPrintCommand

Parameter
Type
Explanation
Mandatory

type

string

Use the value "feed".

line

number

Number of lines to feed (i.e., how many lines the paper should move forward).

value

string

Optional value that might include additional information or metadata related to the feed command.

📤 Create print job

This route is dedicated to create a printjob on the printer.

POST https://api.fyre.app/api/v1/printers/onebox/{printerId}/printjobs

HTTP headers: X-API-KEY: <your token>

Route Params⬇️

{
    printedId: string // The id of the printer.
}

Payload ⬇️

{
printJob: 
}

📤 Responses

201 - Created print job

Print job created successfully.

{
  "id": "058ZKyO45czdvdzcObHk",
  "created_at": "2022-06-27T09:50:06.639Z",
  "status": "pending"
}
401 - Unauthorized

Unauthorized.

{
  "status": 401,
  "message": "Request Authorization not found",
  "code": "AUTHORIZATION_NOT_FOUND",
  "value": ""
}
422 - Unprocessable entity

Unprocessable entity, missing parameter.

{
  "status": 422,
  "message": "Printer id not found",
  "code": "PRINTER_ID_NOT_FOUND",
  "value": ""
}
500 - Server error

Server error.

{
  "status": 500,
  "message": "Error creating print job",
  "code": "ERROR",
  "value": ""
}

📖 Route Params Example

{
    printerId: "X6X7071613"
}

📖 Payload example

{
  "commands": [
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "Quartier libre"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "Quai des Savoirs"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "31000, Toulouse"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "Table 1"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "YZJJ"
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "height": 1,
      "type": "text",
      "value": "[email protected]",
      "width": 1
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "text",
      "value": "12:46 04/07/2022"
    },
    {
      "type": "text",
      "value": "----------------------------------------"
    },
    {
      "type": "text",
      "value": "4 AOP Crozes-Hermitage           18.00 €"
    },
    {
      "type": "text",
      "value": "----------------------------------------"
    },
    {
      "height": 2,
      "type": "text",
      "value": " ",
      "width": 2
    },
    {
      "type": "text",
      "value": "Total        79.00 €"
    },
    {
      "height": 1,
      "type": "text",
      "value": " ",
      "width": 1
    },
    {
      "line": 1,
      "type": "feed"
    },
    {
      "type": "cut",
      "typetype": "feed"
    }
  ],
  "type": "epos"
}

📩 Get print job status

This route is used to get the print job status on the printer.

GET https://api.fyre.app/api/v1/printers/onebox/{printerId}/printjobs/{printjobId}

HTTP headers: X-API-KEY: <your token>

Route Params⬇️

{
    printerId: string, //The ID of the printer.
    printjobId: string // ID of the print job
}

📤 Responses

200 - Success

Print job status.

{
  "id": "058ZKyO45czdvdzcObHk",
  "created_at": "2022-06-27T09:50:06.639Z",
  "status": "printed",
  "executed_at": "2022-06-27T09:50:08.639Z",
  "updated_at": "2022-06-27T09:50:09.639Z"
}
401 - Unauthorized

Unauthorized.

{
  "status": 401,
  "message": "Request Authorization not found",
  "code": "AUTHORIZATION_NOT_FOUND",
  "value": ""
}
422 - Unprocessable entity

Unprocessable entity, missing parameter.

{
  "status": 422,
  "message": "Printer id not found",
  "code": "PRINTER_ID_NOT_FOUND",
  "value": ""
}
500 - Server error

Server error.

{
  "status": 500,
  "message": "Error retrieving print job",
  "code": "ERROR",
  "value": ""
}

📖 Route Params Example

{
    printerId: "X6X7071613",
    printjobId: "058ZKyO45czdvdzcObHk"
}

Last updated