Connect to Jeroen Steeman on LinkedIn Follow Jeroen Steeman on Facebook

So you want a QR code generator for your website too!

Well that should not be a problem. In two easy steps you can have a QR code generator for your website and also use it in other applications. This QR code API is driven by simple HTTP web requests (URLs) and returns a ready to use QR code image. A sample of how to create dynamic QR codes in your website is included.

The QR code API is located at https//www.qr4.nl/Gen.aspx

QR Code API URL

Step1: Get a QR code API key

QR4 offers free API access keys, all you have to do is ask for one to be sent to your email address. You can request a QR code API key here.

Request QR Code API Key

Besides requesting an API key, this page also shows you a working sample of how easy it is to create dynamic variable QR codes for your web pages using Java script. In the example the URL of the current web page is determined and used as content to create a QR code. You can also attach it to a database to generate QR codes with references to products or links to product pages. After you fill in and send the request you receive the API key via email.

QR Code API Key Email

The email contains your API key and it also has a test URL so you can test your key immediately to confirm the QR code generator is responding.

Step2: Making your own QR codes with the API

It's as simple as making a web request like typing in a URL, and you get a QR code image back from the service.

How it works 

The QR code generator is behind https//www.qr4.nl/Gen.aspx and accepts commands or instructions in the form of parameters. Two parameters are always needed, these are key and type, where the key is the information you received in the email, the type determines what type of QR code you want. At present four types of QR codes are supported:

  1. Text
  2. Direct call
  3. SMS messages
  4. Direct Wifi access (for Android devices)

Depending on user requests other QR code types may be added, so keep an eye on the API page for up-to-date specifications on all the new options that become available. The main page of the API is pretty clear on how to format a request for a QR code, but becareful to check what is returned. An incorrect key or wrong parameter will return HTML and not image information, this can also be used to check whether your request is valid.

A working example of the QR Code API in action

An example of how to request a text message QR code from the API showing the complete request and allowing you to determine the message via a standard input text box.

https//www.qr4.nl/Gen.aspx?key=testkey&type=text&cont=

The code to make this possible is a line or two of java script you can copy and paste into your own website. It uses one text box and an image, but there is nothing stopping you to expand on this and offer more features of the QR code API in your site.

<script type="text/javascript">// <![CDATA[
        function getQR(img) {
            img.src = "https//www.qr4.nl/Gen.aspx?key=testkey&type=text&cont=" +
document.getElementById('myText').value; } // ]]></script>

You need to replace the 'testkey' in the request above with a valid API key and you can then allow your websites, blogs and even desktop applications and mobile devices that have Internet access to become QR code generators.

4.1

QR4 is maintained by Jeroen Steeman - Geleenhof 42, 5655 AH Eindhoven - Tel: +31 (0)6 130 33 743