Say Goodbye To Long URLs
Have you ever had a URL that you needed to post on your website that was so long it pushed the layout out of whack? What about a link in an email that you sent where the URL was so long that most people's email readers break it into two lines, leading to a series of claims from your recipients that "the link does not work"? There is a solution, and it is about as simple as it is genius, called Tinyurl. Tinyurl is a web service that allows you to convert large, bulky URLs into clean, tiny URLs. Simply submit the URL that you want to convert and they will return a smaller URL.
In addition to going to their website to convert URLs by hand, which is handy if you are looking to convert one of two problematic URLs into Tinyurl's for a blog post or an email blast, you can also use the Tinyurl API to convert URLs. In itself an impression display of simplicity, the API provides a way that programmers can convert URLs to Tinyurls for use in an application. Not sure what I am talking about? A great example is Twitter.com, which allows users to post small "tweets" about what they are doing. Enter a URL into one of your tweets, and if it is too long it will be automatically converted into a Tinyurl. In the case of Twitter, this is a great way to ensure that the "tweets" remain compact and easy to read by removing all bulky and long URLs.
For programmers looking to use the Tinyurl API, it is a snap. Pretty much everything that you will need is this URL:
http://tinyurl.com/api-create.php?url=http://URL_TO_CONVERT
Obviously, you want to replace the url variable with the URL that you want to convert into a Tinyurl. As an example, in order to convert http://www.practicalecommerce.com to a Tinyurl, I would send a GET request to the Tinyurl API like this:
http://tinyurl.com/api-create.php?url=http://www.practicalecommerce.com
What is returned is the converted Tinyurl, which in this example is http://tinyurl.com/67m4lr. Piece of cake. I love the simplicity of it all.
While it seems like such a minor thing to think about, the service that Tinyurl provides seems to be very much in demand. Considering the number of hits per month that they claim to get (over 1.5 billion) it would seem that they have created a service that people really like. I personally think that it makes a great example of what we talk about with Web 3.0 services, in that Tinyurl is dedicated towards solving one little problem and doing it well. Applications that require a solution such as that, like Twitter for Tinyurl, tap into the service and it makes everyone's life easier.
It's not hard to imagine a web application that interfaces with Tinyurl to limit URL sizes, interfaces with Akismet to reduce spam, and also interfaces with reCAPTCHA to verify that users are humans. It doesn't seem like much, but this kind of team work is how things are going to get done in the future, and I personally welcome great innovations like Tinyurl.
This post is filed under Developers' Corner and has the following keyword tags: Tinyurl, api.
2 Comments
spammb says:
If you like tinyurl, I also recommend you try http://kindurl.com/. It provides prettified urls (similar to the url of this article). I find I get a lot more hits when I use kindurl than tinyurl, as kindurl provides context which you don't get out of a tinyurl hash. kindurl has a similar undocumented api which is slightly different than tinyurl. A GET to http://kindurl.com/quickurl/BASE64URL where BASE64URL is the URL encoded using urlsafe base64 encoding.
Jamie Grove says:
Great post, Brian.
One thing I've noticed with the public URL shortening services is that public proxies are starting to filter those links. I've had that experience with tinyurl at two big coffee chains.
One way to get around this would be to install an open source solution on your own server. TightURL (http://tighturl.com/project/) is PHP/MySQL-based but there are others out there for almost every language.