API for qr.cx
v1.1 (last changed 16.06.09)
qr.cx provides a basic API (Application Programming Interface) which can be used to harness our URL shortening service for other applications. This works by accessing a particular URL on the qr.cx site which accepts the long URL you would like shortened as a parameter. The shortened URL (or various error conditions) will then be returned in the HTTP response.
Submitting a URL for shortening
Simply have your application access a URL similar to the following,
via an HTTP GET request:
The "http://example.com" parameter in the example above may be replaced by whatever URL you wish to shorten.
After submitting the LONG-URL as specified above, an HTTP response (web page) will be returned.
On success the HTTP response will contain only the short url in plain text.
If an error occurs an error message will be printed. It will lead with "error: " and the rest of the message should explain what went wrong.
Encoding
It is advised to encode the URL to be shortened to be URI safe (e.g.: convert all special characters like space to %20).
Getting an original URL from a shortened URL
If you want to retrieve the original long URL from a URL shortened with qr.cx, the API does provide a function for this;
via an HTTP GET request:
you can be explicit about the plaintext and add "mode=plain" to the query, see below (since v1.1).
There is a method to get a link like this http://qr.cx/1r8. call:
this will return a html link with the long url as title (since v1.1).
Limits
-
All URLs longer than 2500 and shorter than (currently) 16 characters will be rejected.
URLs that have not been clicked at least thrice within one week since their creation may be deleted.
We do not shorten URLs from other shorteners. (if a url is not blocked at creation it may be deleted later on).
Terms
This service is provided without any guarantee and as is. Links to illegal and suspicious sites will be deleted. Austrian law applies. Please report misuse to abuse [at] qr.cx