Ez.com API

Currently the Ez.com API only supports GET calls to all methods. Below is documentation and sample code to use the API. API Keys are available only for registered accounts so Sign Up if you need one. You can obtain your API Key by going to your Profile page. Please report issues or ask questions by visiting our Support site. Thanks for giving the API a try!

API Primary Base URL

http://ez.com/api/v1

Request Variables in GET call

It is always best to url encode all your variables especially the long url and notes. See sample code below on how do do this in PHP.

Examples

http://ez.com/api/v1/ezlinks/shrink?api_key=abc&
long_url=http%3A%2F%2Fwww.liveoak360.com&notes=some%20long%20notes

Responses in JSON or plain text

Examples

{success: 1, ezlink: http://ez.com/e92j, hash: e92j}

http://ez.com/e92j

Authentication

Must supply API Key in GET call

Parameters

  • api_key As assigned in Ez.com registered account

Examples

http://ez.com/api/v1/ezlinks/shrink?api_key=abc&long_url=http://liveoak360.com

Shrink with /ezlinks/shrink

Parameters

  • long_url A long URL you wish to shrink
  • notes The notes to attach to the newly created Ez link. (Note: can be changed later)
  • redirect_type Type of Redirect: 301 or 307. (Note: 307 is default)
  • alias Custom alias you wish to assign to short link. (optional)
  • format Choose txt or json (Note: json is default)

Examples

http://ez.com/api/v1/ezlinks/shrink?api_key=abc&long_url=http://liveoak360.com&notes=abc&redirect_type=307&alias=abcd

JSON Response Values

  • ezlink Full URL of Ez
  • hash Hash value of Ez
  • ezlink_preview Full URL of Ez preview link

Examples

{success: 1, ezlink: http://ez.com/e92j, hash: e92j, ezlink_preview: http://ez.com/e92j?}
{"success":0,"error_code":400,"error_message":"Ez Link/Custom Alias is not available! Try another."}
{success: 0, error_code: 100, error_message: "Invalid API key."}
http://ez.com/e92j

Expand with /ezlinks/expand

Parameters

  • ezlink Ez link you wish to expand. (Note: will only accept full URL of Ez link)

Examples

http://ez.com/api/v1/ezlinks/expand?ezlink=http://ez.com/eji9
http://ez.com/api/v1/ezlinks/expand?ezlink=http://go.liveoak360.com/eji9

Response Values

  • long_url Full URL of expanded Ez link

Notes

API Key not required

Examples

{success: 1, long_url: http://liveoak360.com}
{success: 0, error_code: 100, error_message: "Invalid API key."}

Click count with /clicks/count

Parameters

  • ezlink Ez link you wish to receive click counts. (Note: will only accept full URL of Ez link)
  • date_from Starting date of date range for click count YYYY-MM-DD (Note: optional unless date_to is set)
  • date_to Ending date of date range for click count YYYY-MM-DD (Note: optional)
  • daily If set to 1, will show a daily breakdown of counts

Examples (Note: first example will provide total click count for entire history)

http://ez.com/api/v1/clicks/count?api_key=abc&ezlink=http://ez.com/eji9

http://ez.com/api/v1/clicks/count?api_key=abc&ezlink=http://ez.com/eji9&date_from=2010-01-01

http://ez.com/api/v1/clicks/count?api_key=abc&ezlink=http://ez.com/eji9&date_from=2010-01-01&date_to=2010-01-31&daily=1

http://ez.com/api/v1/clicks/count?api_key=abc&ezlink=http://go.liveoak360.com/eji9&date_from=2010-01-01&date_to=2010-01-31&daily=1

Response Values

  • ezlink Full URL of Ez
  • hash Hash value of Ez
  • count Total click count for date range
  • dates If daily set to 1, list of dates and count key-value pairs.

Examples

{success: 1, ezlink: http://ez.com/e92j, hash: e92j, count: 1390}
{success: 1, ezlink: http://ez.com/e92j, hash: e92j, count: 154, dates: {"2010-01-01":29,"2010-01-02":80,"2010-01-03":45}}
{success: 0, error_code: 100, error_message: "Invalid API key."}

Sample PHP code using curl to shrink a URL


$request =  'http://ez.com/api/v1/ezlinks/shrink?api_key='
         . rawurlencode('abc-key') . '&long_url='
         . rawurlencode('http://liveoak360.com') . '&notes='
         . rawurlencode('abc-notes');

$session = curl_init($request);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($session);
curl_close($session);

$decode = json_decode($response, true);

//to see array
var_dump($decode);


Sample PHP code using curl to expand a Ez



$request =  'http://ez.com/api/v1/ezlinks/expand?ezlink='
         . rawurlencode('http://ez.com/e3ja');

$session = curl_init($request);
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($session);
curl_close($session);

$decode = json_decode($response, true);

//to see array
var_dump($decode);