Shorturl API \ Shorten an URL PHP SDK

Resource/URI GET POST PUT DELETE
Shorturls /shorturls.json List all shorturls Create a shorturl
Shorturl /shorturls/<shorturl_token>.json Read a shorturl Delete a shorturl

Workflow

Request: the code to send to the API

Send a POST request with the following data to the resource /shorturls.json to create a short version of an existing URL. Whenever a user clicks on the short version of the url, that click will be tracked and the user will then be forwarded to the original url.

The click statistics can be obtained by retrieving the details of the shortened url.

POST data to be included in the request

		{
			"request":{
				"shorturl":{
					"original_url": "#url#"
				}
			}
		}
Key Description
* #url# The URL for which you want to create a short url.
Example: http://www.example.org/page.html

Result: the code returned by the API

The API will return the short version of your URL and a shorturl_token that uniquely identifies the created entry.

		{
			"response": {
				"request": {
					"date": "Fri, 16 Sep 2011 16:18:49 +0200",
					"resource": "/shorturls.json",
					"status": {
						"flag": "success",
						"code": 200
					}
				},
				"result": {
					"data": {
						"shorturl": {
							"shorturl_token": "mOTlo",
							"original_url": "http://www.oneall.com/services/",
							"short_url": "http://oal.lu/mOTlo",
							"date_creation": "Fri, 16 Sep 2011 16:18:49 +0200",
							"num_referrals": 0
						}
					}
				}
			}
		}

User Contributed Notes