qr-code-api

{ QR Code API }JSON

With the API you are able to shorten URLs and retrieve statistics about each of your shortened URLs. While shortening an URL you can attach an address to the created QR Code. This is called a geo tagged QR Code. As a registered user you can use the API to add additional geo information like Longitude und Latitude to the QR Code.

As soon someone scans your QR Code, that you attached to your given location, it will be shown in realtime on the
QR Map

Every request returns a JSON response.

To use the API, register here or sign in.

Basic URL Shorten

The following call shortens the given URL:

http://api.qrd.by/short?key=<YOUR_API_KEY_GOES_HERE>&url=http://jungidee.at/projekte

Note:If you want to shorten an URL that contains a &, please use the hexadecimal value %26 instead.

The API will respond with an object notated in JSON with the shortened URL und its QR code:

{ 
    "result":{
      "id":"7W",
      "shorturl":"http://qrd.by/7W",
      "qr":"http://qrd.by/i/7W",
      "url":"http://jungidee.at/contact",
      "creationdate":"2011-10-10 09:40:14",
      "image","",
      "location":{
         "address":"",
         "lng":"",
         "lat":"",
         "note":""
      }
   }
}

Shorten URL with attached Geo Location

You optional attach geo information to your URL. This may be your company address or any location where you want to stick your QR Code. The parameter address is a human readable address string. The parameter lat (Latitude) and lng (Longitude) are used for further machine processing, e.g. to show the location on a map. The note parameter is used to add a detailed description about the location (e.g. 2nd floor, left door). You may add an image with the parameter image, that contains the path to the image.

http://api.qrd.by/short?key=<YOUR_API_KEY_GOES_HERE>&url=http://jungidee.at/contact&
address=Deublerstreet 37&lng=16.3909&lat=48.2675&note=2nd floor, left door

The API will respond with an object notated in JSON like above, but with the added geo information.

{ 
    "result":{
      "id":"7W",
      "shorturl":"http://qrd.by/7W",
      "qr":"http://qrd.by/i/7W",
      "url":"http://jungidee.at/contact",
      "creationdate":"2011-10-10 09:33:03",
      "image","",
      "location":{
         "address":"Deublerstreet 37",
         "lng":"16.3909",
         "lat":"48.2675",
         "note":"2nd floor, left door"
      }
   }
}

List all Geo Tagged QR Codes

The following call is an example on how to retrieve a list of all your Geo Tagged QR Codes:

http://api.qrd.by/geotags?key=<YOUR_API_KEY_GOES_HERE>

The response includes a list of all your Geo Tagged QR Codes with the number of scans and unique visitors for each code. You will also find the original URL and location data (if attached):

{
    "result": {
        "geotags": [
            {
                "id":"3P",
                "shorturl": "http://qrd.by/3P",
                "qr": "http://qrd.by/i/3P",
                "url": "http://jungidee.at",
                "scans": "12",
                "uniquevisitors": "10",
                "creationdate": "2011-10-08 22:19:48",
                "image": "/u/3P.jpg",
                "location": {
                    "address": "Deublergasse 37, 1210 Wien, Österreich",
                    "lng": "16.3909",
                    "lat": "48.2675",
                    "note": "Haustüre rechts"
                }
            },
            {
                "id":"4L",
                "shorturl": "http://qrd.by/4L",
                "qr": "http://qrd.by/i/4L",
                "url": "http://qrd.by/l/kayiko",
                "scans": "17",
                "uniquevisitors": "10",
                "creationdate": "2011-10-12 13:08:38",
                "image": "/u/4L.jpg",
                "location": {
                    "address": "Windmühlgasse 16, 1060 Wien, Österreich",
                    "lng": "16.3566",
                    "lat": "48.1992",
                    "note": "An der Türe"
                }
            },
            {
                "id":"7k",
                "shorturl": "http://qrd.by/7k",
                "qr": "http://qrd.by/i/7k",
                "url": "http://www.map-studio.com",
                "scans": "0",
                "uniquevisitors": "0",
                "creationdate": "2011-10-27 21:26:23",
                "image": "",
                "location": {
                    "address": "Schönburgstraße 27, 1040 Wien, Österreich",
                    "lng": "16.3703",
                    "lat": "48.1864",
                    "note": "Rooftop"
                }
            },
            {
                "id":"7q",
                "shorturl": "http://qrd.by/7q",
                "qr": "http://qrd.by/i/7q",
                "url": "http://www.derstaud.at",
                "scans": "9",
                "uniquevisitors": "2",
                "creationdate": "2011-10-28 16:05:59",
                "image": "",
                "location": {
                    "address": "Eisstoßgasse 8, 1220 Wien, Österreich",
                    "lng": "16.4397",
                    "lat": "48.2178",
                    "note": "Garage"
                }
            }
        ]
    }
}

Statistic for a single QR Code

The following call is an example about statistics retrieved for a shortened URL. The input parameter are the id of the QR Code and the API Key.

http://api.qrd.by/stat?key=<YOUR_API_KEY_GOES_HERE>&id=7W

The response includes basic statistical data like the original URL, shortened URL, link to the QR Code, address and geo coordinates, followed by: when was the shortened URL first accessed, how much time elapsed between the first and the last call, how often the URL is called by day, the URL's age in days, the number of unique visitors and the total number of requests.
For every request, detailed information about the request date, the country, the region, which browser & version, which OS and which model or brand (if the QR Code was scanned with a mobile device) is saved. If the user sends his location after scanning the QR Code, his position is encoded as lng & lat.

{
   "result":{
      "id":"7W",
      "shorturl":"http://qrd.by/7W",
      "qr":"http://qrd.by/i/7W",
      "url":"http://jungidee.at",
      "creationdate":"2011-10-08 22:19:48",
      "image","",
      "location":{
         "address":"Deublerstreet 37, 1210 Vienna, Austria",
         "lng":"16.3909",
         "lat":"48.2675",
         "note":"2nd Floor right door"
      },
      "firstrequestdate":"2011-10-09 10:32:35",
      "lastrequestdate":"2011-10-09 20:45:36",
      "daysbetweenfirstandlastrequest":"1",
      "dayssincecreated":"3",
      "uniqevisitors":"4",
      "callsperday":"9",
      "requestcount":"9",
      "requests":[         
         {
            "requestdate":"2011-10-09 10:59:41",
            "region":"New York",
            "countrycode":"us",
            "country":"United States",
            "lng":"",
            "lat":"",
            "browser":"BlackBerry",
            "browserversion":"5",
            "os":"RIM OS",
            "model":"BlackBerry 9700",
            "brand":"RIM"
         },
         {
            "requestdate":"2011-10-09 10:59:40",
            "region":"Sunnyvale",
            "countrycode":"us",
            "country":"United States",
            "lng":"",
            "lat":"",
            "browser":"MSIE",
            "browserversion":"7",
            "os":"Windows",
            "model":"",
            "brand":""
         },
         {
            "requestdate":"2011-10-09 10:57:03",
            "region":"Lower Austria",
            "countrycode":"at",
            "country":"Austria",
            "lng":"16.4184",
            "lat":"48.185",            
            "browser":"Safari",
            "browserversion":"",
            "os":"iPhone OS",
            "model":"iPhone",
            "brand":"Apple"
         },
         {
            "requestdate":"2011-10-09 10:32:35",
            "region":"Lower Austria",
            "countrycode":"at",
            "country":"Austria",
            "lng":"",
            "lat":"",
            "browser":"Firefox",
            "browserversion":"6",
            "os":"Windows",
            "model":"",
            "brand":""
         }
      ]
   }
}

API Call with Javascript

Shorten Url

Use the API directly with javascript (jQuery.getJSON). Include the following code snippet into your Webseite to shorten an URL:

<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
    
var url = "http://jungidee.at/home";

var apiKey = "<YOUR_API_KEY_GOES_HERE>";
var apiUrl = "http://api.qrd.by/";

/**
 * Sample API Call to shorten an URL.
 * Please pay attention to the &callback=? parameter an the end of the request.
 * The parameter is used after the API call by jQuery.getJSON to request the 
 * callback function below.
 */
var apiShortUrl = apiUrl + "short?key=" + apiKey + "&url=" + url + "&callback=?";

/*
 * The callback function is called from the API after the URL has been shorted.
 * The name of the function has to be equal to the name of the API method.
 * The resulting JSON object may be accessed through: data.result.         
 * (e.g. data.result.shorturl, data.result.creationdate, etc.)
 */
function short(data) {
    $('#result').html("The URL '" + url + "' was shortend to " + data.result.shorturl);
}

$(function() {
    $('#shortenUrl').click(function() {
        // API Call
        $.getJSON(apiShortUrl);
    });
});
</script>
<div>
    Click <a href="#" id="shortenUrl">here</a> 
    to shorten the URL http://jungidee.at/home.
</div>
<div id="result"></div>
        
Top