About BudURL

Who we are

BudURL.Pro API

Currently the BudURL.Pro 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://BudURL.Pro/api/v2

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://BudURL.Pro/api/v2/links/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, link: http://Ez.com/e92j, hash: e92j}

http://Ez.com/e92j

Authentication

Must supply API Key in GET call

Parameters

  • api_key As assigned in BudURL.Pro registered account

Examples

http://BudURL.Pro/api/v2/links/shrink?api_key=abc&long_url=http://liveoak360.com

Shrink with /links/shrink

Parameters

  • long_url A long URL you wish to shrink
  • notes The notes to attach to the newly created 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)
  • dupe_check Set to 1 if you want system to return last created short link that matches long_url (character for character and case sensitive) instead of creating a new short link.

Examples

http://BudURL.Pro/api/v2/links/shrink?api_key=abc&long_url=http://liveoak360.com&notes=abc&redirect_type=307&alias=abcd

JSON Response Values

  • link Full URL of Link
  • hash Hash value of Link
  • link_preview Full URL of preview link

Examples

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

Expand with /links/expand

Parameters

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

Examples

http://BudURL.Pro/api/v2/links/expand?link=http://Ez.com/eji9
http://BudURL.Pro/api/v2/links/expand?link=http://go.liveoak360.com/eji9

Response Values

  • long_url Full URL of expanded 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

  • link Link you wish to receive click counts. (Note: will only accept full URL of 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://BudURL.Pro/api/v2/clicks/count?api_key=abc&link=http://Ez.com/eji9

http://BudURL.Pro/api/v2/clicks/count?api_key=abc&link=http://Ez.com/eji9&date_from=2010-01-01

http://BudURL.Pro/api/v2/clicks/count?api_key=abc&link=http://Ez.com/eji9&date_from=2010-01-01&date_to=2010-01-31&daily=1

http://BudURL.Pro/api/v2/clicks/count?api_key=abc&link=http://go.liveoak360.com/eji9&date_from=2010-01-01&date_to=2010-01-31&daily=1

Response Values

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

Examples

{success: 1, link: http://Ez.com/e92j, hash: e92j, count: 1390}
{success: 1, link: 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://BudURL.Pro/api/v2/links/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 Link



$request =  'http://BudURL.Pro/api/v2/links/expand?link='
         . 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);