800-903-6571
Order Tracking
Login
Cart
Products
Receipt Printers
Barcode Printers
Barcode Scanners
LIVE Tech Support
Blog
Contact Us
800-903-6571
Cart
Introducing POSGuys Barcode API V.0.1
By:
Siva Katir
- 4/11/2014
<p>Today we're excited to announce the availability of our barcode image API. This is the system that we use to back our online <a href="https://posguys.com/barcode">barcode generator</a>.</p> <p>Read on for a quick look at how to get started using our Image and Image path APIs!</p> <p><br /></p> <h2>Image Path</h2> <p>The Barcode Image Path API will generate the requested barcode and send back a string that is the URL of the image. This is useful for pre-generating an image so that you can download it or link to it repeatedly.</p> <p><br /></p> <h3>Basic Ussage</h3> <pre><code>https://posguys.com/Api/GenerateBarcodeLink/?content=test&height=200&width=200&hideText=true&symbology=QR_CODE return: https://posguys.com/Api/BarcodeImage/44EAB645783128354826641F74DF2CE4 </code></pre> <p><strong>Paramaters:</strong></p> <ul> <li>content: A URL Encoded string to be barcoded</li> <li>height: Image height in pixels</li> <li>width: Image width in pixels</li> <li>hideText: (boolean: true/false) Do not display content string in image</li> <li>symbology: See list of string values in the table below.</li> </ul> <p><strong>Example:</strong></p> <pre><code>https://posguys.com/Api/GenerateBarcodeLink/?content=http%3a%2f%2fwww.posguys.com%2fbarcode-scanner_3%2fHoneywell-Voyager-1200g_1050%2f&height=200&width=200&hideText=true&symbology=QR_CODE return: https://posguys.com/Api/BarcodeImage/F1535116E57BAF2C7D80CC8719739750 </code></pre> <p><br /></p> <h2>Image</h2> <p>The Image API will return an <code>image/png</code> image directly, this is useful for putting the <code>GET</code> request as the <code>src</code> tag in an <code><img /></code>.</p> <p><br /></p> <h3>Basic Usage</h3> <pre><code>https://posguys.com/Api/GenerateBarcodeImage/?content=http%3a%2f%2fwww.posguys.com%2fbarcode-reader-scanner_3%2fHoneywell-Voyager-1200g_1050%2f&height=200&width=200&hideText=true&symbology=QR_CODE <img src="https://posguys.com/Api/GenerateBarcodeImage/?content=http%3a%2f%2fwww.posguys.com%2fbarcode-scanner_3%2fHoneywell-Voyager-1200g_1050%2f&height=200&width=200&hideText=true&symbology=QR_CODE" width="200" height="200" /> </code></pre> <h3>Result:</h3> <img src="https://posguys.com/Api/GenerateBarcodeImage/?content=http%3a%2f%2fwww.posguys.com%2fbarcode-reader-scanner_3%2fHoneywell-Voyager-1200g_1050%2f&height=200&width=200&hideText=true&symbology=QR_CODE" width="200" height="200" /> <p><br /></p> <h2>Supported Symbologies</h2> <table> <thead> <tr> <th>Symbology Name</th> <th align="left">Request Value</th> </tr> </thead> <tbody> <tr> <td>Aztec</td> <td align="left">AZTEC</td> </tr> <tr> <td>CODABAR</td> <td align="left">CODABAR</td> </tr> <tr> <td>Code 128</td> <td align="left">CODE_128</td> </tr> <tr> <td>Code 39</td> <td align="left">CODE_39</td> </tr> <tr> <td>Data Matrix</td> <td align="left">DATA_MATRIX</td> </tr> <tr> <td>EAN 13</td> <td align="left">EAN_13</td> </tr> <tr> <td>EAN 8</td> <td align="left">EAN_8</td> </tr> <tr> <td>ITF</td> <td align="left">ITF</td> </tr> <tr> <td>MSI</td> <td align="left">MSI</td> </tr> <tr> <td>PDF 417</td> <td align="left">PDF_417</td> </tr> <tr> <td>Plessey</td> <td align="left">PLESSEY</td> </tr> <tr> <td>QR Code</td> <td align="left">QR_CODE</td> </tr> <tr> <td>UPC A</td> <td align="left">UPC_A</td> </tr> </tbody> </table> <p><br /></p> <h2>FAQ</h2> <h3>Why would I use this type of system over say a barcode font?</h3> <p>POSGuys often needs to place barcodes in places that may or may not have a barcode font available. If you need to include a barcode in an email message sending it using the font will fail for most users. Displaying a barcode on a website is equally problematic. If a user doesn't have that specific font installed they won't see the barcode. </p> <p>Even if a user has a barcode font they may not have the right font. Or in the case of QR codes and PDF rendering via a font is simply not feasible (It is technically possible if you're happy to mess with line heights and kerning a bunch).</p> <h3>Is this safe for production?</h3> <p>We use it in production so we think so. This is a true dogfooding API: we use it. We don't use another version, or have a special set a parameters. What is documented above is what we use. It runs on top of our website which is a regionally distributed and load balanced system in multiple data centers. </p> <h3>Attribution</h3> <p>While it's always nice to be recognized for your work there are no requirements for attribution of these images. </p> <p><br /></p> <h2>Caveats</h2> <p><strong>Errors:</strong></p> <p>In the event that a barcode cannot be generated only the <code>GenerateBarcodeLink</code> will tell you why. <code>GenerateBarcodeImage</code> will return an empty response currently. We are currently working on fixing this shortcoming so that both will return a string with the message. </p> <p>The most common reason for failures are:</p> <ul> <li>Invalid Symbology - The symbology string could not be parsed into a valid format.</li> <li>Invalid barcode content - Some barcodes have limitations on the characters that they support. Including unsupported characters will result in an error.</li> </ul> <p><strong>Speed:</strong></p> <p>For the sake of our sanity we do not store the barcode images. This means that for every request the image is re-generated unless it's been requested recently (there is a short cache period). This does mean that there is a slight performance hit every time an image is requested, because of this it's best to set the <code>width</code> and <code>height</code> attributes in the <code><img /></code> tag so that when the image does load it doesn't cause a re-flowing of the content.</p> <p><br /></p> <h2>Enjoy!</h2> <p><strong>-POSGuys Operations</strong></p>
Share this post:
Recent Posts By Siva Katir
Using ASP.NET Custom Authorization Attribute to Hide Page Elements
Filtering for Bots
Let Us Fill Your Excel Spreadsheet With Barcodes
Easily Generate Barcodes using Microsoft Excel for Free
Introducing POSGuys Barcode API V.0.1
Please enable JavaScript to view the comments.