Jer on Rails

Jeremy Weiskotten on web development, startups, beer, and other stuff.


Generating TinyURLs from Rails

Sometimes URLs are just too long, especially if you have constraints like the 140 character limit on Twitter. Free services like TinyURL have been around for years, providing short URLs that issue a permanent redirect to the long URL.
TinyURL has a micro-API. Issuing a simple HTTP GET request to:

http://tinyurl.com/api-create.php?url=http://www.myreallyreallylongurl.com/its-really-long

renders a response like:

http://tinyurl.com/8y94xz

I recently created a Ruby on Rails plugin called tinify_urls that encapsulates this kind of thing, supporting the TinyURL, SnipURL, and is.gd APIs. The plugin has been tested against Rails 2.1.

I’m looking forward to feedback so let me know if you have a chance to try it out. To install the plugin:

script/plugin install git://github.com/jeremyw/tinify_urls.git

Tags:

Comments are closed.