Retrieve an ad (POST)
curl --request POST \
--url https://servedby.hakumedia.ai/adserve \
--header 'Content-Type: application/json' \
--data '
{
"ID": 11111,
"setID": 123456,
"type": "json"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ID: 11111, setID: 123456, type: 'json'})
};
fetch('https://servedby.hakumedia.ai/adserve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://servedby.hakumedia.ai/adserve"
payload = {
"ID": 11111,
"setID": 123456,
"type": "json"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://servedby.hakumedia.ai/adserve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ID' => 11111,
'setID' => 123456,
'type' => 'json'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": "SUCCESS",
"placements": [
{
"placement_1": [
{
"banner_id": 123456,
"width": 300,
"height": 200,
"alt_text": 0,
"accompanied_html": "",
"target": "_blank",
"tracking_pixel": "",
"body": "",
"redirect_url": "https://servedby.hakumedia.ai/redirect.spark?MID=...",
"refresh_url": "",
"refresh_time": 10,
"image_url": "https://servedby.hakumedia.ai/getad.img/;libID=...",
"accupixel_url": "https://servedby.hakumedia.ai/adserve/;ID=...",
"is_redirectable": false,
"eligible_url": "https://servedby.hakumedia.ai/adserve/;MID=XXXX;type=eligibleimpression;...",
"viewable_url": "https://servedby.hakumedia.ai/adserve/;MID=XXXX;type=viewableimpression;..."
}
]
}
]
}Ad serving
Retrieve an ad (POST)
Developers can use this API to retrieve ads in JSON format.
POST
/
adserve
Retrieve an ad (POST)
curl --request POST \
--url https://servedby.hakumedia.ai/adserve \
--header 'Content-Type: application/json' \
--data '
{
"ID": 11111,
"setID": 123456,
"type": "json"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ID: 11111, setID: 123456, type: 'json'})
};
fetch('https://servedby.hakumedia.ai/adserve', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://servedby.hakumedia.ai/adserve"
payload = {
"ID": 11111,
"setID": 123456,
"type": "json"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://servedby.hakumedia.ai/adserve",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'ID' => 11111,
'setID' => 123456,
'type' => 'json'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"status": "SUCCESS",
"placements": [
{
"placement_1": [
{
"banner_id": 123456,
"width": 300,
"height": 200,
"alt_text": 0,
"accompanied_html": "",
"target": "_blank",
"tracking_pixel": "",
"body": "",
"redirect_url": "https://servedby.hakumedia.ai/redirect.spark?MID=...",
"refresh_url": "",
"refresh_time": 10,
"image_url": "https://servedby.hakumedia.ai/getad.img/;libID=...",
"accupixel_url": "https://servedby.hakumedia.ai/adserve/;ID=...",
"is_redirectable": false,
"eligible_url": "https://servedby.hakumedia.ai/adserve/;MID=XXXX;type=eligibleimpression;...",
"viewable_url": "https://servedby.hakumedia.ai/adserve/;MID=XXXX;type=viewableimpression;..."
}
]
}
]
}Cuerpo
application/json
Required for URL Targeting. Our URL Targeting feature traditionally relies on the HTTP referrer header to know which page our ad requests were made on. However, if you're making server-side requests you can pass it to us directly in the ad request using the ;referrer= parameter.
Ejemplo:
"https://example.com"