Articles on: API

AdMaven redirect api



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

Ad-Maven Redirect API


The Ad-Maven 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 Ad-Maven API key.

For example this wrapped link directs to Google.com - [
Using the &data parameter I can use my encrypted string which I got from the API 7AygK4JnmsgPEOGcYVHM9Q%3D%3D to get redirected to bbc.com using the same link instead of getting redirected to the original destination link, Note that the encrypted URL ONLY works with the links created using your key as the encryption is generated per user..

https://daughablelea.com/s?18907e63&data=7AygK4JnmsgPEOGcYVHM9Q%3D%3D

As you can see the addition of &data= using the encrypted link 7AygK4JnmsgPEOGcYVHM9Q%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://publishers.ad-maven.com/api/public/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 Ad-Maven 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://publishers.ad-maven.com/api/public/url_encryptor
{
"destination_url": "google.com",
"api_token": "65ea906106a4be515d7004b84117f2794b6a34081797ba23a74170a44103a6bf
"
}


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://publishers.ad-maven.com/api/public/url_encryptor?destination_url=Google.com&api_token=65ea906106a4be515d7004b84117f2794b6a34081797ba23a74170a44103a6bf

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://publishers.ad-maven.com/api/public/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://publishers.ad-maven.com/api/public/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://publishers.ad-maven.com/api/public/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://publishers.ad-maven.com/api/public/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://publishers.ad-maven.com/api/public/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://publishers.ad-maven.com/api/public/url_encryptor?destination_url=Google.com&api_token={api_token}"

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

# Print response
print(response.json())

Updated on: 03/11/2024

Was this article helpful?

Share your feedback

Cancel

Thank you!