Admaven content Locker API Documentation
API Documentation - Create Link Shortener
API Endpoint:
POST https://fo.ad-maven.com/api/content_locker
Description:
This endpoint allows you to create a link shortener.
The endpoint supports both POST and GET requests
Request Body:
Field Name | Field Description | Field Mandatory | Validation |
---|---|---|---|
title | The title of the link. | Mandatory | String value, Max 30 characters. |
url | The final destination of the content monetizer, this is the link you're locking. | Mandatory | String Needs to be a valid link. |
background | Background is another name for our background, it's the little image/video in the link | Optional | Needs to be a valid link. Could be a link of any image format or a YouTube link. |
POST REQUESTS
Authorization:
When making POST requests to this API endpoint, you should include your API token in the "Authorization" header of your HTTP request. Set the header as follows:
Authorization: Bearer YOUR_API_TOKEN
Replace YOUR_API_TOKEN with your actual API token obtained from The AdMaven Panel Under API.
Response:
If the request is successful, the API will respond with a success message and the details of the created link shortener.
Example POST Request:
POST https://fo.ad-maven.com/api/content_locker
{
"title": "hello",
"url": "https://yourlinkhere.com",
"background": "https://example.com/background.jpg"
}
Example Successfull Response:
{
"type": "created",
"request_time": 556,
"message": {
"title": "test",
"url": "https://yourlinkhere.com",
"background": "https://example.com/background.jpg",
"short": "xxxx",
"desturl": "https://onepiecered.co/s?xxxx"
}
}
Example Failed Response:
{
"type": "error",
"request_time": 3926,
"message": "Missing mandatory field: url"
}
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:
GET https://fo.ad-maven.com/api/content_locker?api_token=<YOURTOKEN>&title=title&url=url.com&background=imageurl.jpg
Example Successfull Response:
{
"type": "fetched",
"request_time": 1519,
"message": [
{
"title": "title",
"url": "url.com",
"background": "https://hips.hearstapps.com/hmg-prod/images/beautiful-smooth-haired-red-cat-lies-on-the-sofa-royalty-free-image-1678488026.jpg",
"short": "nj2v",
"desturl": "https://onepiecered.co/s?nj2v"
}
]
}
Example Failed Response:
{
"type":"error",
"request_time":572,
"message":"Internal Server Error"
}
API endpoint exmaples
Python GET request
import requests
url = "https://fo.ad-maven.com/api/content_locker"
api_token = "YOUR_API_TOKEN"
headers = {} # No Authorization header needed for GET requests authorization in query parameter api_token
params = {
"api_token": api_token,
"title": "title",
"url": "url.com",
"background": "imageurl.jpg"
}
response = requests.get(url, params=params, headers=headers)
print(response.json())
Python POST request
import requests
# Replace with your actual API token and parameter values
api_token = "YOUR_API_TOKEN"
title = "title"
url_value = "url.com"
background = "imageurl.jpg"
# Send GET request with query parameters
response = requests.get(f"https://fo.ad-maven.com/api/content_locker?api_token={api_token}&title={title}&url={url_value}&background={background}")
# Print response
print(response.json())
Javascript GET request
const apiToken = "YOUR_API_TOKEN";
const title = "title";
const urlValue = "url.com";
const background = "imageurl.jpg";
// Construct the URL with query parameters
const url = `https://fo.ad-maven.com/api/content_locker?api_token=${apiToken}&title=${title}&url=${urlValue}&background=${background}`;
// Send GET request
fetch(url)
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Javascript POST request
const apiToken = "YOUR_API_TOKEN";
// API Endpoint
const url = "https://fo.ad-maven.com/api/content_locker";
// Request body data
const requestBody = {
title: "hello",
url: "https://yourlinkhere.com",
background: "https://example.com/background.jpg"
};
// Send POST request
fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiToken}`
},
body: JSON.stringify(requestBody)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
Updated on: 23/01/2024
Thank you!