{API}

Create

Parameters

Name Type Description
api key string your api key
url string Base64 encoded version of your long url. base64_encode() in PHP.

Return values

Name Type Description
url_id int The unique id value of making URL
short_url string Short URL including the domain name.
part_short_url string Short URL without the domain name.
original_url string Original long url
date_create string Date created. In the format dd.mm.YYYY hh:mm:ss

Example request

jQuery.noConflict()(function($){
    $(document).ready(function (e) {
        var url = 'http://l.tp4.ir/api/v1/api.php';
        var url_long = '<?php echo base64_encode("http://l.tp4.ir");?>';
        $.get
          (
             url,'api_key=e00cf25ad42683b3df678c61f42c6bda&url='+url_long,function(result,status)
                {
                    alert(result.data.url_id+'||'+
                            result.data.short_url+'||'+
                            result.data.part_short_url+'||'+
                            result.data.original_url+'||'+
                            result.data.date_create);		
                },
                "json"
        );
    });
});    
    

Example response

{
   "status":200,
   "data":{
      "url_id":"1",
      "short_url":"http://l.tp4.ir/P87Ayv",
      "part_short_url":"P87Ayv",
      "original_url":"http://l.tp4.ir",
      "date_create":"09.05.2024 21:33:35"
   }
}
    
Disable
Name Type Description
api key string your api key
disable_url string Base64 encoded version of your short url. base64_encode() in PHP.

Return values

Name Type Description
url_id int The unique id value of URL
short_url string Short URL including the domain name.
status string Short url status.
date_create string Date created. In the format dd.mm.YYYY hh:mm:ss

Example request

jQuery.noConflict()(function($){
    $(document).ready(function (e) {
        var url = 'http://l.tp4.ir/api/v1/api.php';
        var url_short = '<?php echo base64_encode("http://l.tp4.ir/P87Ayv");?>';
        $.get
          (
             url,'api_key=e00cf25ad42683b3df678c61f42c6bda&disable_url='+url_short,function(result,status)
                {
                    alert(result.data.url_id+'||'+
                            result.data.status+'||'+
                            result.data.short_url+'||'+
                            result.data.date_create);		
                },
                "json"
        );
    });
});    
    

Example response

{
   "status":200,
   "data":{
      "url_id":"1",
      "status":"disabled",
      "short_url":"http://l.tp4.ir/P87Ayv",
      "date_create":"09.05.2024 21:33:35"
   }
}
    
Activate
Name Type Description
api key string your api key
enable_url string Base64 encoded version of your short url. base64_encode() in PHP.

Return values

Name Type Description
url_id int The unique id value of URL
short_url string Short URL including the domain name.
status string Short url status.
date_create string Date created. In the format dd.mm.YYYY hh:mm:ss

Example request

jQuery.noConflict()(function($){
    $(document).ready(function (e) {
        var url = 'http://l.tp4.ir/api/v1/api.php';
        var url_short = '<?php echo base64_encode("http://l.tp4.ir/P87Ayv");?>';
        $.get
          (
             url,'api_key=e00cf25ad42683b3df678c61f42c6bda&enable_url='+url_short,function(result,status)
                {
                    alert(result.data.url_id+'||'+
                            result.data.status+'||'+
                            result.data.short_url+'||'+
                            result.data.date_create);		
                },
                "json"
        );
    });
});    
    

Example response

{
   "status":200,
   "data":{
      "url_id":"1",
      "status":"enable",
      "short_url":"http://l.tp4.ir/P87Ayv",
      "date_create":"09.05.2024 21:33:35"
   }
}
    
Info
Name Type Description
api key string your api key
enable_url string Base64 encoded version of your short url. base64_encode() in PHP.

Return values

Name Type Description
url_id int The unique id value of URL
long_url string The original decoded long url.
short_url string Short url part. (excluding domain name)
create_time string Date created. In the format dd.mm.YYYY hh:mm:ss
clicks int Total visits
preview_img string Link on the preview image
qr_img string Link to image qr-code
favicon string Link to the favicon
status string Short url status.
password bool Whether the url needs a password to access.

Example request

jQuery.noConflict()(function($){
    $(document).ready(function (e) {
        var url = 'http://l.tp4.ir/api/v1/api.php';
        var url_short = '<?php echo base64_encode("http://l.tp4.ir/P87Ayv");?>';
        $.get
          (
             url,'api_key=e00cf25ad42683b3df678c61f42c6bda&info_url='+url_short,function(result,status)
                {
                    alert(result.data.url_id+"||\n"+
                        result.data.long_url+"||\n"+
                        result.data.short_url+"||\n"+
                        result.data.create_time+"||\n"+
                        result.data.clicks+"||\n"+
                        result.data.preview_img+"||\n"+
                        result.data.qr_img+"||\n"+
                        result.data.favicon+"||\n"+
                        result.data.status+"||\n"+
                        result.data.password);		
                },
                "json"
        );
    });
});    
    

Example response

{
   "status":200,
   "data":{
     "url_id":"1",
        "long_url":"http://l.tp4.ir",
        "short_url":"P87Ayv",
        "create_time":"09.05.2024 21:33:35",
        "clicks":"63",
        "preview_img":"http://l.tp4.ir/images/l.tp4.ir.png",
        "qr_img":"http://l.tp4.ir/qrcodes/P87Ayv.png",
        "favicon":"http://l.tp4.ir/favicons/l.tp4.ir.ico",
        "status":"enable",
        "password":"true"
   }
}
    
List

Parameters

Name Type Description
api key string your api key
list boolean true

Return values

Name Type Description
short_url string Short URL including the domain name.

Example request

jQuery.noConflict()(function($){
    $(document).ready(function (e) {
        var url = 'http://l.tp4.ir/api/v1/api.php';
        $.get
          (
             url,'api_key=e00cf25ad42683b3df678c61f42c6bda&list_url=true',function(result,status)
                {
                    alert(result.data.short_url);		
                },
                "json"
        );
    });
});    
    

Example response

{
   "status":200,
   "data":{
      "short_url":{
      		"http://l.tp4.ir/P87Ayv",
                "http://l.tp4.ir/sdw12v",
                "http://l.tp4.ir/P415av"
      		}
   }
}