Skip to content

Tag Management API: QR Codes

GeneStevens edited this page Mar 10, 2012 · 4 revisions

This section describes how to use our API to generate and download QR code images. Our default "PNG" QR code images are high resolution and have incredibly small file sizes.

Retrieving a single QR code

  • Format /tags/item/{itemID}/qrcode/{imageType}/{gridSize}
  • Verbs GET

Notes

  • {itemID} can be no larger than 64 characters
  • {itemID} must be properly URL-encoded in order to successfully store and retrieve it later
  • {itemID} is case-sensitive! E.g., "Item-001" and "item-001" are different IDs.
  • {imageType} is optional and will default to "png"
  • The resulting PNGs are 1-bit colormap, non-interlaced
  • {gridSize} is optional and will default to "16"
  • Valid values are: 4, 8, 16, 32, 48
  • The value refers to the pixel size of individual blocks that comprise the resulting image.
  • The value "16" will generally result in a 528x528 PNG at 461 Bytes in size.
  • The value "48" will generally result in a 1024x1024 PNG at 1.1K in size. Yep, 1.1 Kilobytes.
  • You can avoid sending the {imageType} and {gridSize} URI parameters
  • This will shorten the URI to /tags/item/{itemID}/qrcode

Example curl request

curl -v -k -X GET  \
		-H "X-ActiveTag-AccessToken: 16cc9f55-8c34-433e-af7a-0054884f7648" \
		"https://api.taglabsinc.com/tags/item/item-001/qrcode" \
		-o item-001.png

> GET /tags/item/item-001/qrcode HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: api.taglabsinc.com
> Accept: */*
> X-ActiveTag-AccessToken: 16cc9f55-8c34-433e-af7a-0054884f7648
>

Example curl response

< HTTP/1.1 200 OK
< Date: Fri, 16 Dec 2011 22:14:46 GMT
< Server: Apache/2.2.20 (Ubuntu)
< Content-Length: 468
< Accept-Ranges: bytes
< Vary: User-Agent
< Content-Type: image/png
<

Verify the downloaded file:

Example file verification

$ file item-001.png
item-001.png: PNG image data, 528 x 528, 1-bit colormap, non-interlaced
$ ls -lh item-001.png
-rw-r--r--  1 gene  staff   1.1K Dec 16 15:08 item-001.png

Clone this wiki locally