Epom Ad Server allows creating or updating the Placement-Banners Linking via API. This method overwrites banner to placement links.

URL: /rest-api/placements/{placementId}/banners.do
Method: GET
Response format: application/json

Error codes:

  • 401 Unauthorized – authentication error.

Response sample:

200 OK
{"success":true, id:} - success, returns id of affected banners records.
{"success":false} - error.
{"success":false, "error":"permission_denied"} - error due to insufficient privileges.

Parameters:

  • hash – an MD5 digest of a concatenated username's MD5 password and a given timestamp.
  • timestamp – UNIX timestamp in milliseconds used in hash generation.
  • username – the given username.
  • ids – Banner IDs.
  • append – (optional) boolean parameter to link Banners-Placements without overriding; true/false(default).

<?php
define("DEBUG",false);

/*Initiating username and password variables, generating current timestamp and hash*/
$username = "username";
$password = "123456";
$timestamp = round(microtime(true) * 1000);
$hash = md5($password.$timestamp);
$placementId = 312;
/*Constructing API URL which fetches data in HTML format*/
$url = "https://n100.epom.com/rest-api/placements/$placementId/banners.do";

$post_data = array(
"username" => $username,
"timestamp" => $timestamp,
"hash" => $hash,
"ids" => "4,23,25"
);
/*Specifying CURL options*/
$options = array(
CURLOPT_URL => $url,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_CUSTOMREQUEST => "PUT", //PUT method is used
CURLOPT_POSTFIELDS => http_build_query($post_data),//specifying request body parameters
CURLOPT_HTTPHEADER => array('Content-type: application/x-www-form-urlencoded'),
//This header is mandatory when parameters are passed in request body.
CURLOPT_RETURNTRANSFER => true
);

/*Connection initiation*/
$curl = curl_init();
/*Applying CURL options to our CURL instance*/
curl_setopt_array($curl,$options);
/*Executing the call*/
$result=curl_exec($curl);
echo $result;

if(DEBUG){
echo "\n\n";
echo $url;
print_r($post_data);
}

?>

Need more help?

Should you require any additional help with our solutions, do not hesitate to contact Epom technical support at support@epom.com. Our support managers are dedicated to resolving any issues and providing you with solutions and support if you face difficulties or have questions.