General

The API comes in three flavours: JSON(P) and HTML. The format will be determined by the HTTP Accept header and the X-Requested-With header:

The URLs are the same as for the web interface. The only difference is your HTTP Accept header. All data will be UTF-8 encoded.

Post a new page

JSON/HTML

URL:/
Method:POST
Parameters:
  • url: The URL of the page for which to generate a long URL.
Returns:{orig_url: <the original URL>, long_url: <the long URL containing the domain name and page title in max. 110 characters>, short_url: <the "short long" URL containing the domain name and page title in max. 70 characters>}
Errors:
  • 400: When the given URL is invalid.
  • 404: When web page at the given URL could not be found.

JSONP

URL:/
Method:GET
Parameters:
  • url: The URL of the page for which to generate a long URL.
  • jsonp: Necessary to trigger a jsonp result. You should use 1 as the value.
  • callback (optional): The JSONP callback function name. Defaults to p.
Returns:{orig_url: <the original URL>, long_url: <the long URL containing the domain name and page title in max. 110 characters>, short_url: <the "short long" URL containing the domain name and page title in max. 70 characters>}
Errors: As JSONP cannot transport HTTP status codes natively we return them in the result like this: {error_code: <code>, error_message: <message>} where the codes are as follows:
  • 400: When the given URL is invalid.
  • 404: When web page at the given URL could not be found.

Get the original URL for a long URL

JSON/HTML

URL:/<long url alias>
Method:GET
Parameters:None. The requested page is in the GET path.
Returns:{orig_url: <the original URL>}. Does an HTTP redirect when not asking for JSON.
Errors:
  • 400: When the given URL is invalid.
  • 404: When there has been no page stored for the alias.

JSONP

URL:/<long url alias>
Method:GET
Parameters:
  • jsonp: Necessary to trigger a jsonp result. You should use 1 as the value.
  • callback (optional): The JSONP callback function name. Defaults to p.
Returns:{orig_url: <the original URL>}.
Errors: As JSONP cannot transport HTTP status codes natively we return them in the result like this: {error_code: <code>, error_message: <message>} where the codes are as follows:
  • 400: When the given URL is invalid.
  • 404: When there has been no page stored for the alias.

Latest 20 entries

JSON/HTML

URL:/latest
Method:GET
Parameters:None.
Returns: [{orig_url: ..., long_url: ..., date: 'YYYY-MM-DDThh:mm:ssZ'}]
Errors:Hopefully none.

JSONP

URL:/latest
Method:GET
Parameters:
  • jsonp: Necessary to trigger a jsonp result. You should use 1 as the value.
  • callback (optional): The JSONP callback function name. Defaults to p.
Returns: [{orig_url: ..., long_url: ..., date: 'YYYY-MM-DDThh:mm:ssZ'}]
Errors:Hopefully none.

The latest entries are also available as an Atom Feed.