API - Guidelines

For developers rlx.im prepared API which returns responses in JSON or TEXT formats, currently there is one method which can be used to shorten links on behalf of your account.

All you have to do is to send a GET request with your API token and URL Like the following:

https://rlx.im/links/api?api=API_KEY&url=yourdestinationlink.com&alias=CustomAlias

You will get a JSON reposnse like the following

{"status":"success","shortenedUrl":"https://rlx.im/xxxxx"}

If you want a TEXT reposnse just add &format=text at the end of your request as the below example. This will return just the short link. Note that if an error occurs, it will not output anything.

https://rlx.im/api/?api=API_KEY&url=yourdestinationlink.com&alias=CustomAlias&format=text

Note

api & url are required fields and the other fields like alias & format are optional.

That's it :)

Using the API in PHP

To use the API in your PHP application, you need to send a GET request via file_get_contents or cURL. Please check the below sample examples using file_get_contents

Using JSON Response

$api_url = "https://rlx.im/api/?api=API_KEY&url=yourdestinationlink.com&alias=CustomAlias";
$result = @json_decode(file_get_contents($api_url),TRUE);
if($result["status"] === 'error') {
 echo $result["message"];
} else {
 echo $result["shortenedUrl"];
}

Using Plain Text Response

$api_url = "https://rlx.im/api/?api=API_KEY&url=yourdestinationlink.com&alias=CustomAlias&format=text";
$result = @file_get_contents($api_url);
if( $result ){
 echo $result;
}