So What is This About?

Omani.ac is a URL shortener. Really long urls can be substituted by a shorter one which forwards browers to the original web address.

Please note that illegal or offensive URLs will be removed.

or

Application Programming Interface (API)

Quick start:

If your system has curl (and it should!), you’ve already got a great way to poke around the API. Here are some examples:

  • Create a shortened url:
    curl -d url="http://[some domain]/[some page]" http://omani.ac/api/shorten.xml
  • Lookup forward address:
    curl -d ref="http://omani.ac/[some ref]" http://omani.ac/api/lookup.xml

Examples:

Here's an example php script available for download. (Rename from .txt to .php.)

Requests:

Methods are returned in xml format

<?xml version="1.0" encoding="UTF-8"?> <omaniac>
 <status>[OK or Error]</status>
 <code>[status code]</code>
 <url>(Only if status is OK) [some url]</url>
</omaniac>

Status codes

  • 100 - OK. New shortened url successfully created
  • 101 - OK. Shortened url already exists
  • 102 - OK. Forward address look-up found
  • 200 - Error. Invalid address. (Must begin with http:// and be more than 12 characters long.)
  • 201 - Error. No url parameter posted.
  • 202 - Error. No such shortened url.
  • 203 - Error. Invalid address. (Must begin with http://omani.ac/.)
  • 204 - Error. No ref parameter posted.
  • 3xx - Error. Database error.

Methods:

Shorten - Creates a shortened forwarding url.
URL: http://omani.ac/api/shorten.xml
Format: xml
Parameters:

  • url. Destination address of the shortened url.

Lookup - Looks up the destination of a shortened forwarding url.
URL: http://omani.ac/api/lookup.xml
Format: xml
Parameters:

  • ref. The shortened url.