API Documentations
This API use sample way to use our services for make url short .
API PATH = “https://api.rlnk.us/api/api.php”
Build you first request :
Example for add short by 3 ways
1- POST:
Request =[]
Request[“ver” ]= “1”
Request [“key” ]= “abcdef0123456789”
Request [“action” ]= “add”
Request[“url” ]= “https://www.cnn.com/”
HTTP POST - > Request -> https://api.rlnk.us/api/api.php
2- GET:
https://api.rlnk.us/api/api.php?ver=1&action=add&key= abcdef0123456789&url=https://www.cnn.com/
3- JSON
Build your json statements
Request = {"ver":"1","action":"add","key":" abcdef0123456789","url":"http://www.cnn.com/"}
HTTP POST - > Request -> https://api.rlnk.us/api/api.php
Request parameters:
1- Require parameters:
ver : version of API to use.
action : functions type for request.
add : add new short .
Require: (url), Optional(etc)
update : update short already added.
Require: (slnk), Optional(etc)
get : retrieve data for short link.
Require: (slnk), Optional(etc)
active : enable or disable short link.
Require: (slnk), Optional(etc)
renew : update short link if it expire.
Require: (slnk), Optional(etc)
key : you APIKEY to authorizes to API, can get key from user setting after sign up
2- Options parameters:
url:
description : long url need to make short url .
type : string.
Length : 2048
Require by : action(add)
slnk:
description : short link generated by short function.
type : string.
Length : 11
Require by : action(update,get,active,renew)
days:
description : number of days short link will still live from create date.
type : string number.
Length : 4
Default : 3650
Optional by : action(add,update)
title :
description : title of long url default from long url.
type : string UTF8.
Length : 128
Default : “” , if it is default will get default data from long url.
Optional by : action(add,update)
clicks :
description : limit of number of clicks can short link open.
type : string number.
Length : 7
Default : 0 , if it is default will get default data from long url.
Optional by : action(add,update)
urlpin :
description : pin code can protect short link open.
type : string number.
Length : 6
Default : 0 , if it is default will disable pin url .
Optional by : action(add,update)
enable:
description : enable or disable short link.
type : string.
Length : 5
Default : true, can be also (true,1) for enable/ (false,0) for disable .
Optional by : action(add,update)
favorite:
description : add or remove short link to favorite .
type : string.
Length : 5
Default : true, can be also (true,1) for add/(false,0) for remove .
Optional by : action(add,update)
qrcode:
description : request qrcode png img base64 in response .
type : string.
Length : 5
Default : true, can be also (true,1) to get data/ (false,0) remove data from response .
Optional by : action(add,get)
allowcountry:
description : country can open short link .
type : string, json array.
Length : 64
Default : [“0”], to allow all country or can select only country you allow [“US”,”RU”,”TR”]
Optional by : action(add,update)
allowtype:
description : device can open short link .
type : string, json array.
Length : 64
Default : [“0”], to allow all type of device
'0'='All'
'1'='Desktop'
'2'='Mobile Phone'
'3'='Tablet'
'4'='TV Device'
Optional by : action(add,update)
Response items:
The respone will be json format
ver:
description : response version for your request .
type : string.
Length : 3
Note :
status:
description : response status have (“fail”,” success”) .
type : string.
Length : 7
Note : another item response will has note for status
message:
description : description of response status .
type : string.
Length : 128
Note :
ref:
description : reference code for you short link .
type : string.
Length : 11
Note : this refrance will be use for (update,get,active,renew) as “slnk”
slnk:
description : full path of your short link .
type : string.
Length : 25
Note :
expire:
description : expire date for your short link .
type : string.
Length : 20
Note : expire date is GMT date time
title:
description : title of your long link or tag already you request .
type : string.
Length : 128
Note : UTF8
url:
description : long url as your request .
type : string.
Length : 2048
Note :
qrcode:
description : png data base46 for short link .
type : string.
Length : 4096
Note : can cancel this if you request have qrcode=false
Examples:
PHP example
$apipath="https://api.rlnk.us/api/api.php";
$Request=array();
$Request["ver"]= "1";
$Request ["key"]= "abcdef0123456789";
$Request ["action"]= "add";
$Request["url"]= "https://www.cnn.com/";
$curl_init = curl_init($apipath);
curl_setopt($curl_init, CURLOPT_CONNECTTIMEOUT,5);
curl_setopt($curl_init, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_init, CURLOPT_POSTFIELDS, $Request); // normal POST
//curl_setopt($curl_init, CURLOPT_POSTFIELDS, json_encode($Request)); //JSON POST
$response = curl_exec($curl_init);
curl_close($curl_init);
echo $response ;
CURL Command Line Example
curl -d "ver=1&key=abcdef0123456789&action=add&url=https://www.cnn.com/" https://api.rlnk.us/api/api.php
or
curl "https://rlnk.us/api/api.php?ver=1&key=abcdef0123456789&action=add&url=https://www.cnn.com/"
JAVA Example
Pure javascript
var url = "https://api.rlnk.us/api/api.php";
var xhr = new XMLHttpRequest();
xhr.open("POST", url);
xhr.setRequestHeader("Accept", "application/json");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {
console.log(xhr.responseText);
}};
var data = `{
"ver":"1",
"key": " abcdef0123456789",
"action": "add",
"url": "https://www.cnn.com/"
}`;
xhr.send(data);
AJAX javascript
$.ajax({
type: "POST",
url: "https://api.rlnk.us/api/api.php",
data: `{
"ver":"1",
"key": "abcdef0123456789",
"action": "add",
"url": "https://www.cnn.com/"
}`;
success: function () {
if (xhr.readyState === 4) {
console.log(xhr.status);
console.log(xhr.responseText);
}},
dataType: "json"
});
Response for all Example:
{
"ver": "1",
"status": "success",
"message": "Your link was added before and still active.",
"ref": "fwPqmi",
"slnk": "https://rlnk.us/fwPqmi",
"expire": "2022-02-14 02:49:20",
"url": "https://www.cnn.com/",
"title": "www.cnn.com",
"qrpic":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAF0AAABdAQMAAAD9v/iAAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxA
GVKw4bAAABGUlEQVQ4jY3TMc6FIAwA4BIGNr0ACddw40p6AZ9eQK7ExjVIuABuDMT+5Wn+jT4JiX5DsS0W4N0yiNIFWBWiZ6BB0TZnAMHiE+Shqgjm/AE6PeE
LHJAu9QOgYLaY1ZNOB3SuXgLtp7gOaOmPr/8N6kA61GOABSkPBrBQgDJ70SsH41DuBaiVM48SqYN5MrtnAIOtM+gR4wAM5AWUotxUy6APk20VKA8r23e6oHqo
cplbMAOZLeWKrqSNgxYFZjBnae3uw7gQV5t2rxfPYZsiPcBCayIDm7LFHfHicE9NFN6woDcYADF8b66LNjwYkvNmY/EJ+htZ7zFjIIIepnbBLGBQlKUePYf2g
2J8hraLVs+IsIR6N6CDd+sParWyQRPujicAAAAASUVORK5CYII="
}