urlshortshort-url

Dynamically generate short URLs for a SQL database?


My client has database of over 400,000 customers. Each customer is assigned a GUID. He wants me to select all the records, create a dynamic "short URL" which includes this GUID as a parameter. Then save this short url to a field on each clients record.

The first question I have is do any of the URL shortening sites allow you to programatically create short urls on the fly like this?


Solution

  • TinyUrl allow you to do it (not widely documented), for example:

    http://tinyurl.com/api-create.php?url=http://www.stackoverflow.com/

    becomes http://tinyurl.com/6fqmtu

    So you could have

    http://tinyurl.com/api-create.php?url=http://mysite.com/user/xxxx-xxxx-xxxx-xxxx

    to http://tinyurl.com/64dva66.

    The guid doesn't end up being that clear, but the URLs should be unique

    Note that you'd have to pass this through an HTTPWebRequest and get the response.