Long URL Please

Lengthening short urls so that you don't have to.

Home Install Firefox Extension Use API Blog Apps

Make your apps better with Long URL Please

JSON api

URL: http://longurlplease.appspot.com/api/v1.1 (optional https)

Format: JSON (application/json)

Methods: GET

Paramaters:
  • q - url to lengthen. Multiple values allowed (up to 10 are decoded).
  • callback - (optional) if provided, then response will be wrapped in a call to this function.

Examples from the command line

Calling API with multiple values for 'q' paramater.

curl 'http://www.longurlplease.com/api/v1.1?q=http://bit.ly/enAo&q=http://short.ie/bestxkcd'

{"http://short.ie\/bestxkcd": "http:\/\/razvan784.blogspot.com\/2007\/09\/best-of-xkcd.html",
 "http://bit.ly\/enAo": "http:\/\/www.boasas.com\/?c=1030"}

Calling API with a callback function.

curl 'http://www.longurlplease.com/api/v1.1?q=http://bit.ly/enAo&callback=withFunk'

withFunk({"http://bit.ly\/enAo": "http:\/\/www.boasas.com\/?c=1030"})

javascript library

To save you writing your own custom javascript - we provide a simple library that will cover most usages, and currently supports jQuery, flXHR and Adobe Air applications.

Usage

  1. Load longurlplease javascript plugin
    <script type="text/javascript"
            src="http://www.longurlplease.com/js/longurlplease.js"></script>
  2. Use the longurlplease lengthen function to replace short urls with their originals.
    longurlplease.lengthen();

longurlplease.lengthen takes an options hash

jQuery plugin

If you are using jQuery then the longurlplease javascript library will act as a plugin to jQuery adding functions to lengthen short urls.

Usage

Use longurlplease function to replace short urls with their originals.

$('#to-replace').longurlplease();
or to replace all short urls in the document, simply
$.longurlplease();
customise behaviour with options:
$.longurlplease({lengthenShortUrl : function(aTag,longUrl){...}});

Demo

To demonstrate that you have fine control over which parts of your document to change, only the first set of links will be lengthened.

Source
$("button#run-demo").click(function () {
  $(this).hide();
  $("#pleaseLengthenMe").longurlplease();
});

Adobe Air

More information in this blog post. Check out the sample project.

flXhr

flXHR allows cross domain client to server requests. It exposes a Javascript api identical to XMLHttpRequest but allows cross domain requests thanks to some flash goodness and crossdomain.xml policy files.

Using flxhr with longurlplease is a breeze - simply set the transport option to 'flxhr' and make sure you've the necessary flxhr files included in your page.

Check out this demo for a working example.

by Peel Me A Grape
Say Hello: darragh@peelmeagrape.net Tweet @longurlplease Latest Changes (11th May 2011)