/* INSTALL PRINT-API MODULE Require the print-api package and set a apiKey. */ const apiKey = 'EFLDjI7hR6833ZSrLe8psZyFh5j6QKE2nWAkWOC3'; const print = require("print-api")(apiKey, { test: true }); /* GET A PRINT QUOTE AND DELIVERY PROMISE We need a request data containing a valid product, destination and currency information. Print-api comes with an example method to get a valid data object you can use. */ let example = print.example(); console.log(example); /* Once we have the data ready, we request a quote. */ let response = await print.quote(example); console.log(response.body); /* PLACING AN ORDER The quote request, returns a production object, containing country of production, and possible shipment methods to the destination, with different min and max delivery days. Select one of the shipment methods promiseUid to place an order. */ let shipments = response.body.production.shipments; let order = await print.order(shipments[0].promiseUid); console.log(order.body);
Save on
Powered by
Node 10.16.3