Shorturl API \ Shorten an URL PHP SDK

Send a POST request to the following resource to create a short version of an existing URL. Passing an URL through our URL Shortener enables you to track clicks on this URL. The corresponding reports can be viewed in the User Insights section of your account.

Resource/URI GET POST PUT DELETE
Shorturls /shorturls.json List all Shorturls Create a new Shorturl
Shorturl /shorturls/<shorturl_token>.json Read details of 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.

		{
			"request":{
				"shorturl":{
					"original_url": "#url#"
				}
			}
		}
Key Description
* #url# The URL for which you want to create a short url, i.e. 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
						}
					}
				}
			}
		}

Usage Example - Measure the impact of a newsletter

We send a newsletter to our customers and we would like to measure how many customers click on a link included in the email (i.e. http://www.oneall.com/).

Instead of including the original URL in our newsletter, we create a shorter url for it (i.e. http://oal.lu/NoFSx) and include this version in the newsletter. When a customer now clicks on the shortened URL, his click will be logged and he will instantly be redirected to the original URL.

We can now check the User Insights section of our account and see how many customers have clicked on the link in our newsletter. The same procedure can be used to measure other advertising channels like for example Google AdWords.

User Contributed Notes