Our Town America URL Shortener

For otwn.us and otwn.net

There are 3 main API functions: creating a short URL, getting info about a shortened URL, redirecting the shortened URL to it's destination.

All functions return a JSON object containing an error (boolean) indicating if there is an error, a message (string) with a message if there is an error, and a data object which contains the result of the function called.


Creating a short URL

Endpoint: ourtown.us/?c=URL_TO_SHORTEN

Parameter: URL_TO_SHORTEN: The URL to be shortened, URL encoding is optional.

This will create a new shortened URL, if it does not exist already, or else return information about the existing record for this URL.

Returns:

The data property of the result object contains the following properties:


Reading info on a short URL

Endpoint: (provided in the stats_url property when a new URL is created)

This will provide stats and a paginated list of page hits for a shortened URL.

Returns:

The data property of the result object contains the following properties:


Using a short URL

Endpoint: (provided in the stats_url property when a new URL is created)

This will create a log of the user's IP and the current time and redirect to the full URL. Nothing is returned.