bizprint-api

Node.js Print Backend API docs


PrintClient object

Properties


Creating an instance of PrintClient

Creates a new print client object with which you can manipulate and work with different Stations, Printers and Jobs instances.

Note: for instruction of how to get publicKey and secretKey, please visit next url: https://getbizprint.com/quick-start-guide/#step-4

JSON Body

// note: these are sample keys, and they are not valid for use
const client = new PrintClient({
    publicKey: 'c321430d35c6d425799db9f85a11d50b',
    secretKey: '321430d35c6d425799db9f85a11d50b0'
});

Returns

The newly created object, which corresponds to this type.


Jobs object

Properties

See TypeScript definition of Jobs object properties:

export type Jobs = {
    id: number;
    description: string;
    status: JobStatus;
    url: string;
    printerId: number;
    createdAt: string;
    updatedAt: string;
};

export type JobStatus =
    | 'pending'
    | 'processing'
    | 'done'
    | 'failed'
    | 'connecting-to-printer'
    | 'archived';

Creating a job

Creates a job for a printer with passed parameters.

JSON Body

An object with following properties: 

const createJob = async () => {
    const job = await client.Jobs.create({
        printerId: 1,
        description: 'Test job',
        url: 'https://localhost:8000/order/35'
    });
};

Returns

The newly created object, which corresponds to this type.

Possible errors


Retrieve a Job

Retrieves a job with a given ID.

Parameters

const getSingleJob = async () => {
    const job = await client.Jobs.retrieve(1);
};

Returns

Returns an object, which corresponds to this type.

Possible errors


List Jobs

Return a list of jobs.

Query Parameters

We can get our list in two ways:

const getListOfJobs = await () => {
    const jobs = await client.Jobs.list({ perPage: 10, page: 3 });
};
const getListOfJobs = await () => {
    let allJobs = [];
    for await (let jobs of client.Jobs.list()) {
        allJobs = allJobs.concat(jobs.data);
    }
};

Returns

Returns an object with following properties:

Possible errors


Stations object

Properties

See TypeScript definition of Stations object properties:

export type Stations = {
    id: number;
    name: string;
    createdAt: string;
    updatedAt: string;
};

Retrieve a Station

Retrieves a station with a given ID.

Parameters

const getSingleStation = async () => {
    const station = await client.Stations.retrieve(1);
};

Returns

Returns an object, which corresponds to this type.

Possible errors


List Stations

Return a list of stations.

Query Parameters

We can get our list in two ways:

const getListOfStations = await () => {
    const stations = await client.Stations.list({ perPage: 1 });
};
const getListOfStations = await () => {
    let allStations = [];
    for await (const stations of client.Stations.list()) {
        allStations = allStations.concat(stations.data);
    }
};

Returns

Returns an object with following properties:

Possible errors


Printers object

Properties

See TypeScript definition of Printers object properties:

export type Printers = {
    id: number;
    name: string;
    key: string;
    status: 'online' | 'offline';
    station: {
        id: number;
        name: string;
    };
    createdAt: string;
    updatedAt: string;
};

Retrieve a Printer

Retrieves a printer with a given ID.

Parameters

const getSinglePrinter = async () => {
    const printer = await client.Printers.retrieve(1);
};

Returns

Returns an object, which corresponds to this type.

Possible errors


List Printers

Return a list of printers.

Query Parameters

We can get our list in two ways:

const getListOfPrinters = await () => {
    const printers = await client.Printers.list();
};
const getListOfPrinters = await () => {
    let allPrinters = [];
    for await (const printers of client.Printers.list()) {
        allPrinters = allPrinters.concat(printers.data);
    }
};

Returns

Returns an object with following properties:

Possible errors


General errors

Errors that might occur for any api request: