Introducing the dynamIt URL-shortening API

While using the Tweetie 2 Twitter client on my iPhone a couple of weeks ago, I realized the app developer saw fit to include the option of using any URL shortening service I might desire if the shortening service provided an appropriate API.

API stands for Application Programming Interface. An API allows software to interact with other software. Twitter clients use the Twitter API to implement features of Twitter and access tweets, Twitter uses the API to shorten links using the service, and we have made creative use of various APIs on sites like Columbus College of Art and Design (which uses the Google Calendar API to power its deep set of event and news listings).

Since dynamIt already has a URL shortener built into our site, all we needed was a suitable API. I was able to use the existing scripting to generate and store the shortened URL, and only needed to adjust how the shortened URL was returned for suitable API use.

TinyURL has set a precedent for the simplest response possible—just the new shortened URL. Try calling the following action in your browser where [URL] is the URL you would like to shorten:[URL]

The response will be the resulting shortened URL in plain text. You can optionally include the title of the page whose URL you are shortening as well:[TITLE]&url=[URL]

While this simple plain text response can be interpreted by most applications, some developers may prefer a / JSON style response that looks something like this:

{ "shortUrl": "" }

If so, just add the URL variable “json=true” to the API call (with or without the optional [TITLE] variable):[URL]

The Tweetie 2 application I use on my iPhone will accept either format. In Tweetie 2, go to Settings > Services > URL Shortening > Custom and enter:

Or if you want to use the / JSON format just for fun:

Tweetie URL Settings Tweetie URL API

Tweetie recognizes “%@” as where it should include the URL in the API call. Now whenever I am tweeting from my phone and want to include a URL, Tweetie will automatically use the URL shortener to shorten the link for me!

Test Tweet

Are there other places where you might like to use our URL shortener?