0

addInventoryIdentifier method

Hello

I did some changes to APT PHP Sample Code , added addInventoryIdentifier function and i called it from demoPublisher function

When tried to add AdSize to a website using addInventoryIdentifier method, the service returns error message says: Insufficient Parameters, despite sending all parameters described in yahoo apt service overview and apt api reference.

Please help me to find the error, here is the php code:
CODE
<?php
function addInventoryIdentifier($publisherAccountID, $accountLocation,$siteID) {
$inventoryData['name']="My Inv";
$inventoryData['siteID']=$siteID;
$targetingAttributeDescriptors = array();

$targetingService = self::createClient("TargetingDictionaryService", $publisherAccountID, $accountLocation);

$response = self::execute($targetingService, "getTargetingAttributesByValue",array('targetingAttributeType'=>'AdSize','value'=>'468x60'));
$adSizeAttr = $response->out->TargetingAttributeValue;

$adSizeDescriptors['targetingAttributeID'] = $adSizeAttr->ID;
$adSizeDescriptors['targetingAttributeType'] = $adSizeAttr->type;



$inventoryData['targetingAttributeDescriptors'][0]=$adSizeDescriptors;


$inventoryService = createClient("InventoryIdentifierService", $publisherAccountID, $accountLocation);

$response = execute($inventoryService, "addInventoryIdentifier",array('inventoryIdentifier'=>$inventoryData));
}
?>

by
1 Reply
  • Hi Ashraf,

    I'm not sure this will work, but try using this code. it looks like the getTargetingAttributesByValue function is expecting targetingAttributeType to be an object.

    CODE
        $response =  self::execute($targetingService, "getTargetingAttributesByValue",array(
    'targetingAttributeType'=>array(
    'AdSize' => '468x60'
    )
    );






    QUOTE (Ashraf @ Jan 3 2010, 03:32 AM) <{POST_SNAPBACK}>
    Hello

    I did some changes to APT PHP Sample Code , added addInventoryIdentifier function and i called it from demoPublisher function

    When tried to add AdSize to a website using addInventoryIdentifier method, the service returns error message says: Insufficient Parameters, despite sending all parameters described in yahoo apt service overview and apt api reference.

    Please help me to find the error, here is the php code:
    CODE
    <?php
    function addInventoryIdentifier($publisherAccountID, $accountLocation,$siteID) {
    $inventoryData['name']="My Inv";
    $inventoryData['siteID']=$siteID;
    $targetingAttributeDescriptors = array();

    $targetingService = self::createClient("TargetingDictionaryService", $publisherAccountID, $accountLocation);

    $response = self::execute($targetingService, "getTargetingAttributesByValue",array('targetingAttributeType'=>'AdSize','value'=>'468x60'));
    $adSizeAttr = $response->out->TargetingAttributeValue;

    $adSizeDescriptors['targetingAttributeID'] = $adSizeAttr->ID;
    $adSizeDescriptors['targetingAttributeType'] = $adSizeAttr->type;



    $inventoryData['targetingAttributeDescriptors'][0]=$adSizeDescriptors;


    $inventoryService = createClient("InventoryIdentifierService", $publisherAccountID, $accountLocation);

    $response = execute($inventoryService, "addInventoryIdentifier",array('inventoryIdentifier'=>$inventoryData));
    }
    ?>
    0
This forum is locked.

Recent Posts

in General - APT