Print Labels
POST <qbench-url>/qbench/api/v1/samples/label/{labelId}
Will return the raw HTML content of labels for the list of Samples passed in as a JSON payload
Example request:
POST /qbench/api/v1/samples/label/101 HTTP/1.1
Authorization: Bearer 63ff42c5-49e6-42e2-bc3f-04fbfc22bbcb
Host: <qbench-url>
JSON Payload:
{
"entity_dicts":
[
{ "id": 7558, "count": 2 },
{ "id": 7559, "count": 2 }
]
}
Example response:
<!DOCTYPE html> <html> <head> <meta charset="US-ASCII"> <style> @Page { size: 2.25in 1.25in; margin: 0in; } table { width: 100%; } td { padding: 0px; } body { margin: 0px; font-weight: bold; font-family: arial; font-size: 10px; } .label { page-break-after: always; overflow: visible; height: .625in; width: .875in; padding: 5px; } .qbench-ent-barcode { height: 40px; width: 40px; } </style> </head> <body> <div class="label"> <table> <tr> <td style="text-align: center;"> <canvas class="qbench-sample-qrcode" data-url="https://qbench.net" /> </td> <td style="text-align: center;">Sample QBS-7558</td> </tr> <tr> </tr> </table> </div> <div class="label"> <table> <tr> <td style="text-align: center;"> <canvas class="qbench-sample-qrcode" data-url="https://qbench.net" /> </td> <td style="text-align: center;">Sample QBS-7558</td> </tr> <tr> </tr> </table> </div> <div class="label"> <table> <tr> <td style="text-align: center;"> <canvas class="qbench-sample-qrcode" data-url="https://qbench.net" /> </td> <td style="text-align: center;">Sample QBS-7559</td> </tr> <tr> </tr> </table> </div> <div class="label"> <table> <tr> <td style="text-align: center;"> <canvas class="qbench-sample-qrcode" data-url="https://qbench.net" /> </td> <td style="text-align: center;">Sample QBS-7559</td> </tr> <tr> </tr> </table> </div> </body> <script src="//dpe4x5tiyshba.cloudfront.net/qbenchassets/qbc/assets/js/jquery.min.js"></script> <script src="//dpe4x5tiyshba.cloudfront.net/qbenchassets/qbc/assets/plugins/bwip-js/2.0.10/dist/bwip-js-min.js" type="text/javascript"></script> <script type="text/javascript"> $('.qbench-sample-qrcode').each(function() { let targetUrl = $(this).data('url'); let canvas = bwipjs.toCanvas(this, { bcid: 'qrcode', text: targetUrl, scale: 1, }) }); window.onload = function() { window.print() } </script> </html>
The following list contains all the possible API endpoints for label printing and utilizes a similar payload:
POST <qbench-url>/qbench/api/v1/batches/label/{labelId}
POST <qbench-url>/qbench/api/v1/inventory/label/{labelId}
POST <qbench-url>/qbench/api/v1/locations/label/{labelId}
POST <qbench-url>/qbench/api/v1/orders/label/{labelId}
POST <qbench-url>/qbench/api/v1/samples/label/{labelId}
POST <qbench-url>/qbench/api/v1/tests/label/{labelId}
POST <qbench-url>/qbench/api/v1/projects/label/{labelId}
POST <qbench-url>/qbench/api/v1/equipment/label/{labelId}
Comments
0 comments
Please sign in to leave a comment.