Ez.com API

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 using our Contact Us Form. Thanks for giving the API a try!

API Primary Base URL

http://ez.com/api/v1/ezlinks

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 format

Examples

{success: 1, ezlink: http://ez.com/e92j, hash: 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

Version in GET call URL

Examples

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

Name-spaced functions in GET call URL

Examples

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

Notes

Here for reference only – in order to accommodate future name spaced functions such as clicks, reports, charts, etc…

Shrink with /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

Examples

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

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: 100, error_message: "Invalid API key."}

Expand with /expand

Parameters

  • ezlink Ez 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."}

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);