miniQR.com

API

Ok, hi - miniQR.com has a simple API with an HTTP Request version and a JavaScript version.

Check out the QR-Code-Generator example on how easy (very very easy) and fast (5 minutes) it is to code your own QR-Code-Generater with this API.

HTTP Request API

http://miniqr.com/api/create.php
the basic URL for the miniQR.com api call. all parameters can be submitted via GET or POST. GET is cooler (personal opinion).

http://miniqr.com/api/create.php?api=http
defines api type, possible values are http and js, if server side use http, if client side, use js. default is http.

http://miniqr.com/api/create.php?api=http&content=test
defines the text string you want to miniQR. up to 10002000 chars. please don't forget to urlencode the value.
content= is the only required parameter, everything else is optional


http://miniqr.com/api/create.php?api=http&content=test&size=150
the size of the QR-code image in px. size refferes to width and height of the image. max 500px / default 150px 300px.

http://miniqr.com/api/create.php?api=http&content=test&size=150&rtype=pageredirect
rtype (short for response type) defines the action after a successull request. possible values are:

http://miniqr.com/api/create.php?api=http&content=test&size=150&rtype=pageredirect&md5=1455690eb2be433d6a7d581345ad0094
currently this parameter does nothing.

http://miniqr.com/api/create.php?api=http&content=test&size=150&rtype=pageredirect&ps=test
ps ... preferred shortcut. this parameter gives miniQR.com how the short url should look like, max 14 characters, . / \ and some other special characters not allowed. if the preferred shortcut string has been used before or the content has been miniQRed before (with the same size) this parameter gets ignored.

JS API (D E P R E C A T E D)

The JS API is basically a simple AJAX wrapper around the HTTP Request API.
Note:The JS API is deprecated. Please use JSON with a nice callback instead.

To enable the JS API on you page include this line in the <head> section:
<SCRIPT src="http://miniqr.com/api/create.js" type="text/javascript"></SCRIPT>
then call the miniQR(); function somewhere in the code.
simple miniQR(); test without any parameters
you get a nice alert pop up with some HTML code in there. best to look into the original JS file to see why (the miniQR() function is at the bottom).
http://miniqr.com/api/create.js the function gets called like this
miniQR (content, callback, size, rtype, rid, md5, method);
every parameter (see HTTP API for parameter explainations) is optional, if "content" is blank the document.location (URL of the page) is used.

but to make this API really usefull it's best to define a new callback action (an action that is called after the AJAX request was successful). i.e.:
<div id="test">testdiv</div>
<script>function testQR()
{
	//this means a successful AJAX request
	if(http.readyState == 4)
	{
		var response = http.responseText; //value of the AJAX request
		document.getElementById('test').innerHTML=response;
	}
 }
</script>
<a href="javascript://" onclick="miniQR(document.location, testQR);">test miniQR JS API</a>
testdiv
test miniQR JS API


miniQR (content, callback, size, rtype, rid, md5, method);
the rid (request identifiere) is quite usefull if you have more than one miniQR() requests on one page, it enables to tag the request and identifies the source of the request. the rid values comes back to the callback action if the rtype=phpserialize or rtype=json. (in the most uses, the rid will be a targeted element.id). i.e.: <a href="javascript://" onclick="miniQR('test', miniQR_alert, 150, 'json', this.id,'','POST');" id= "ridtestlink">

miniQR (content, callback, size, rtype, rid, md5, method);
the md5 is a way to move the work of creating an md5 value from the backend to the frontend. that said. it currently does not do that much. leave it blank.

miniQR (content, callback, size, rtype, rid, md5, method);
the method is the HTTP request method used. default is GET, but you can also use POST, i don't care.

Have fun with the API!


NEW QR-CODE | Bookmarklet | API | Widget | About
Create QR-Codes. - miniQR.com is a project by Franz Enzenhofer.