TinyURL API
Heard of TinyURL.com? It’s a redirection service that gives you a short url for your given destination urls which you can use in your web pages or emails. It has served many different purposes for years
- Magazine publishers (print ones!) make its use to shorten the urls that are not only long enough to accommodate in limited spaces, it’s unlikely that users would be able to reproduce the long urls exactly by typing it without errors.
- In the emails where long urls often get malformed and become non-functional. Tinyurls serve a good replacement for long urls.
- For (casual) anonymity to users, such as for hiding affiliate links etc Tinyurls are mostly used.
TinyURL.com does not require you to create an account before starting with creating short urls. Just fill up the form with the long url and press the ‘Make TinyURL!’ button and instantly you get a short url that you can use in place of your given url. TinyURL now also allow an optional alias for your url which you can use to point to your page, given that the alias is not already taken.
So, the short link to previous post on this blog (http://jalaj.net/2009/02/07/bye-bye-top-commentators-list/) is as small as http://tinyurl.com/bh7wnq
That was all about TinyURL that most of you might have already known. Many developers wished if they could find a way to create TinyURLs without manually typing them, from within their online applications. I too wished I could!
But as it appears from the result page the TinyURL portal uses POST submission instead of GET which could have given users ability to use it from online applications using screen scraping.
May be studying the code for the form field might help? Thinking that I opened up the source code for the result page and started looking for form code and was stuck when I read a comment in the code. So TinyURL.com knows exactly where people search
So now we know that there is an API available on request (it’s still not documented on TinyURL.com). It did not take a lot of search after that. It’s as simple as calling a page as below.
http://tinyurl.com/api-create.php?url=<your url here>
The output you get contains just one line containing the TinyURL corresponding to the url that you passed. I have already started using this API and am sure you are not far behind!


