Open API Documentation

 

Version

 

 

Creation

 

  1. API
    • http://tiny-url.info/api/v1/create
  2. Parameter
    • apikey : Your development API Key. (Request API Key)
    • provider : Shorting URL Service Provider. See Provider String List.
    • format : "xml","json" or "text", default value is "text".
    • url : Long URL
    • callback : parameter for jsonp(Optional).
  3. HTTP Method
    • Get
    • Post
  4. Example
    • php
      <?php
      
      	$lurl = $_POST['long_url'];
      
      	$curl = curl_init(); 
      	$post_data = array('format' => 'json',
      					   'apikey' => 'YOUR_API_KEY',
      					   'provider' => 'PROVIDER_STRING',
      					   'url' => $lurl );
      	$api_url = 'http://tiny-url.info/api/v1/create';
      	curl_setopt($curl, CURLOPT_URL, $api_url);
      	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      	curl_setopt($curl, CURLOPT_POST, 1);
      	curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
      	$result = curl_exec($curl);
      	curl_close($curl);
      
      	echo $result;
      
      ?>
      
  5. Return values
    • xml
      1. state : "ok" or "error"
      2. longurl : Original URL
      3. shorturl : Short URL

      • Example
        <?xml version="1.0" encoding="UTF-8"?>
        
            ok
            http://www.google.com/fp=1&cad=b
            http://Selected_provider/random_string
        
    • json
      1. state : "ok" or "error"
      2. longurl : Original URL
      3. shorturl : Short URL

      • Example
        {
            "state":"ok",
            "longurl":"http://www.google.com/fp=1&cad=b",
            "shorturl":"http://Selected_provider/random_string"
        }
    • jsonp
      1. state : "ok" or "error"
      2. longurl : Original URL
      3. shorturl : Short URL

      • Example
        callback({
            "state":"ok",
            "longurl":"http://www.google.com/fp=1&cad=b",
            "shorturl":"http://Selected_provider/random_string"
        })
    • text
      • Returns Provider Url and short url
      • Example
        http://Selected_provider/random_string

 

Random Creation

 

  1. API
    • http://tiny-url.info/api/v1/random
  2. Parameter
    • format : "xml","json" or "text", default value is "text"
    • url : Long URL
    • callback : parameter for jsonp(Optional).
    • don't need API Key
  3. HTTP Method
    • Get
    • Post
  4. Example
    • php
      <?php
      
      	$lurl = $_POST['long_url'];
      
      	$curl = curl_init(); 
      	$post_data = array('format' => 'json',
      					   'url' => $lurl );
      	$api_url = 'http://tiny-url.info/api/v1/random';
      	curl_setopt($curl, CURLOPT_URL, $api_url);
      	curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
      	curl_setopt($curl, CURLOPT_POST, 1);
      	curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
      	$result = curl_exec($curl);
      	curl_close($curl);
      
      	echo $result;
      
      ?>
      
  5. Return values
    • See Creation Return values.

 

Provider String List