Google URL shortener

Summary

Installation

grails install-plugin google-url-shortener

Description

Introduction

Like tinyurl or bit.ly , Google has also its URL shortener service. Beside shorten URLs it also provides some extra services like providing analytics of shorten URLs.
Since 13.01.2011 Google provides an API for this service. This grails plugin wraps this API and povides some convenients methods to shorten your URLs.

Usage

After installing the plugin you have 2 options to shorten or expand your URLs :

using the shorten() / expand() methods which are dynamically added to the String object :

using the Shortener service. Methods of this service, Instead of returning a String , will retrieve an UrlResource instance that contains more information. The service also provides an extra method : getAnalytics() that will retrieves analytics of your shorten URL. The structure of the analytics data follows the API specification (except some property naming convention that was not supported by Grails (id property) or Hibernate (count property) and is made available through Domain classes.

The analytics data structure of the API can be found here : http://code.google.com/apis/urlshortener/v1/reference.html#collection_url