pra.im for developers

Developers wishing to integrate our URL shortening service into their application can easily do so.

Text Interface

This is the easiest mode for embedding pra.im in an application. There are two ways of using the text interface, depending which format you prefer for the reply. You can either send an HTTP post :

  • http://pra.im/api.php?url=your.very.long.url.here, which will return a string in the form of http://abcde.pra.im
  • http://pra.im/api.php?format=alturl&url=your.very.long.url.here, which will return a string in the form of http://pra.im/abcde

If the creation was successful or if the short URL already exists in the database, the web site will return an ASCII string mentioning the shortened URL, If the creation what unsuccessful, the web site will return a HTTP 400 code.

JSON support

You can also get a JSON formatted reply by appending "format=json" to the query. eg http://pra.im/api.php?format=json&url=your.very.long.url.here The reply will look like this:

{"errorCode":"200",
"errorMessage":"Created",
"results":{
	"url":{
			"Url":"http://www.google.com",
			"shortUrl":"http://fbx8y3.pra.im",
			"shortaltUrl":"http://pra.im/fbx8y3",
			"userHash":"fbx8y3",
			"created":"2009-08-20 09:01:34"
		   }
		  }
}

XML support

Similarly, getting a XML formatted reply is as easy as appending "format=xml" to the query. eg http://pra.im/api.php?format=xml&url=your.very.long.url.here

<?xml version="1.0" encoding="UTF-8"?>
<praim>
	<status>200</status>
	<message>Created</message>
	<Url><![CDATA[http://www.facebook.com]]></Url>
	<shortUrl><![CDATA[http://h5pcgs.pra.im]]></shortUrl>
	<shortAltUrl><![CDATA[http://pra.im/h5pcgs]]></shortAltUrl>
	<userHash>5pcgs</userHash>
	<created>2009-08-19 21:53:52</created>
</praim>
	

Expanding a short URL

The syntax is quite similar: http://pra.im/expand.php?format=xml&url=your.short.url.here (or JSON, if you wanted a json-formatted reply). If you omit the "format" parameter, you will get a straight ASCII reply.

In JSON:

{"ErrorCode":"200",
"Message":"Found",
"Results":{
		"url":{
			"url":"http://www.facebook.com",
			"shortUrl":"http://h5pcgs.pra.im",
			"shortaltUrl":"http://pra.im/h5pcgs",
			"Created":"2009-08-19 21:53:52",
			"userHash":"h5pcgs"}
			}
		}
 

In XML:

<?xml version="1.0" encoding="UTF-8"?>
<praim>
	<status>200</status>
	<message>Found</message>
	<Created> 2009-08-19 21:53:52</Created>
	<url><![CDATA[http://www.facebook.com]]></url>
	<shortUrl><![CDATA[http://h5pcgs.pra.im]]></shortUrl>
	<shortaltUrl><![CDATA[http://pra.im/h5pcgs]]></shortaltUrl>
	<userHash>h5pcgs</userHash>
</praim>

Request an API key

You can submit up to 50 links per hour using this service. If you think your application might generate more requests, please ask for an API key.

An API key will allow you to bypass the limits on the number of requests that can be performed. API keys are free and personal, but before issuing them, we would like to know a bit more about you and your use of this URL shortener.

Ask the webmaster for one