Articles on: API & Documentation

LootLabs Redirect API



Note: If you don't have an API-key already learn how to create one by clicking here

Loot Labs Redirect API


The LootLabs Redirect API Allows the use of &data parameter in order to redirect the final destination link to a different link using AES-256 cipher encryption enabled by the Lootlabs API key.

For example this wrapped link directs to Google.com - https://loot-link.com/s?qo0f
Using the &data parameter I can use my encrypted string which I got from the API 8XbVczTDSA%2FD3gX4%2BqLGnw%3D%3D to get redirected to bbc.com using the same link instead of getting redirected to the original destination link.

https://loot-link.com/s?qo0f&data=8XbVczTDSA%2FD3gX4%2BqLGnw%3D%3D

As you can see the addition of &data= using the encrypted link 8XbVczTDSA%2FD3gX4%2BqLGnw%3D%3D redirects you to the new target (bbc.com).

Note: The use of API for encryption is optional as we also provided the Logic for server side encryption for developers if requested, feel free to contact support for more information.




POST https://be.lootlabs.gg/api/lootlabs/url_encryptor

Description:


This endpoint allows you to encrypt links for use in the &data redirect parameter supporting both POST and GET requests

Request Body:


Field NameField DescriptionField MandatoryValidation
destination_urlThe destination you want to encrypt Mandatory String value, valid url.
api_tokenYour LootLabs API token. Mandatory String 64 char hex value


POST REQUESTS



Response:


If the request is successful, the API will respond with an encrypted link you can add to your &data= parameter

Example POST Request:



POST https://be.lootlabs.gg/api/lootlabs/url_encryptor
{
"destination_url": "google.com",
"api_token": "69e9765a5f485e684d0a8ef60bc52407290a0d21bac4ef5e99559d69a0f3c0ab
"
}


Example Successfull Response:



{
    'type': 'created', 
    'request_time': 377, 
    'message': 'oUxJ2u2ePCkLdIsE80YCcg%3D%3D'
}


Example Failed Response:


{

    "type": "error",
    "request_time": 384,
    "message": "Internal Server Error"
}


GET REQUEST



We also support passing parameters in the query parameters GET request using the following syntax:

Authorization


Authorization is checked using the GET request with the query parameter called api_token=<YOURTOKEN> be sure to change yourtoken to the API token you generate in the panel.

Example GET Request:




https://be.lootlabs.gg/api/lootlabs/url_encryptor?destination_url=Google.com&api_token=69e9765a5f485e684d0a8ef60bc52407290a0d21bac4ef5e99559d69a0f3c0ab

Example Successfull Response:



{
    "type": "fetched",
    "request_time": 322,
    "message": "TvgGcq/b%2Bttv1snxr8o6MA%3D%3D"
}


Example Failed Response:



Not Found


Examples of Endpoint API integration:



Javascript/NodeJS POST request



const axios = require('axios');


// API Endpoint
const url = 'https://be.lootlabs.gg/api/lootlabs/url_encryptor';

// Replace 'YOUR_API_TOKEN' with your actual API token
const headers = {
    Authorization: 'Bearer YOUR_API_TOKEN'
};


const data = {
    destination_url: 'https://google.com'
};

// Send POST request
axios.post(url, data, { headers: headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error('Error:', error);
    });


Javascript/NodeJS GET request



const axios = require('axios');



// API Endpoint with query parameters
const api_token = 'YOUR_API_TOKEN'; // Replace with your actual API token
const destination_url = 'https://google.com'; // Example destination URL
const url = `https://be.lootlabs.gg/api/lootlabs/url_encryptor?destination_url=${encodeURIComponent(destination_url)}&api_token=${api_token}`;

// Send GET request
axios.get(url)
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error('Error:', error);
    });


PHP POST Request



<?php


// API Endpoint
$url = 'https://be.lootlabs.gg/api/lootlabs/url_encryptor';

// Replace 'YOUR_API_TOKEN' with your actual API token
$headers = [
    'Authorization: Bearer YOUR_API_TOKEN',
    'Content-Type: application/json'
];


$data = [
    'destination_url' => 'https://google.com'
];

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and get the response
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Print response
echo $response;
?>


PHP GET request



<?php


// API Endpoint with query parameters
$api_token = 'YOUR_API_TOKEN'; // Replace with your actual API token
$destination_url = 'https://google.com'; // Example destination URL
$url = 'https://be.lootlabs.gg/api/lootlabs/url_encryptor?destination_url=' . urlencode($destination_url) . '&api_token=' . $api_token;

// Initialize cURL session
$ch = curl_init($url);

// Set cURL options
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

// Execute cURL session and get the response
$response = curl_exec($ch);

// Close cURL session
curl_close($ch);

// Print response
echo $response;
?>


Python POST Request



import requests


# API endpoint
url = "https://be.lootlabs.gg/api/lootlabs/url_encryptor"

# Your API token
api_token = "YOUR_API_TOKEN"

# Request headers with authorization
headers = {
    "Authorization": f"Bearer {api_token}",
    "Content-Type": "application/json"
}

# Request body data
data = {
    "destination_url": "google.com"
}

# Making the POST request
response = requests.post(url, json=data, headers=headers)

# Printing the response
print(response.json())


Python GET Request



import requests

# API Endpoint with query parameters
api_token = "YOUR_API_TOKEN"  # Replace with your actual API token
url = f"https://be.lootlabs.gg/api/lootlabs/url_encryptor?destination_url=Google.com&api_token={api_token}"

# Send GET request
response = requests.get(url)

# Print response
print(response.json())

Updated on: 28/02/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!