0

How to call searchInventory API in InventorySearchService service

Hi,

We are trying to search inventory using searchInventory API in InventorySearchService. Our aim is to search the inventory for AdSize 50 x 60.

We are using following code.
=================

YahooAPTClient aptClient = new YahooAPTClient(username, password, license, accountID, endPoint, version);

TargetingAttributeType?[] dimensionList = aptClient.TargetingDictionaryService.getSupportedTargetingAttributeTypes();
TargetingAttributeValue[] valueList = aptClient.TargetingDictionaryService.getTargetingAttributes(TargetingAttributeTy
pe.AdSize, true, 0, 344);

Placement pc = new Placement();
pc.adAttributes = new AdAttributes();

pc.adAttributes.adSizeIDs = new long?[] { valueList[0].ID };
pc.accountID = accountID;
pc.startDate = DateTime.Now;
pc.startDateSpecified = true;
pc.contentTargetingAttributes = new ContentTargetingAttributes();
Inventory inv = aptClient.InventorySearchService.searchInventory(pc, null, null, null, null, false);
=========================
Call to searchInventory(..) is giving us error
"A required field is missing or empty: placementTarget. "
Now to solve this error we added following code before calling searchInventory(..) API
==============
pc.contentTargetingAttributes.placementTarget = new PlacementTarget();
pc.contentTargetingAttributes.placementTarget.ID = "234343"; // What should be value for this ID?
pc.contentTargetingAttributes.placementTarget.type = PlacementTargetType.SelfManagedPublisher;
pc.contentTargetingAttributes.placementTarget.typeSpecified = true;
Inventory inv = aptClient.InventorySearchService.searchInventory(pc, null, null, null, null, false);
================
Our problem now is what should be value of following
pc.contentTargetingAttributes.placementTarget.ID = "234343"; // What should be value for this ID?
From where to get placementTargetID ?

Are we using the right API, can anyone help or is there any sample on using InventorySearchService.searchInventory(...) API.

by
2 Replies
  • QUOTE (chore_ashwin @ Jul 13 2011, 02:47 AM) <{POST_SNAPBACK}>
    Hi,

    We are trying to search inventory using searchInventory API in InventorySearchService. Our aim is to search the inventory for AdSize 50 x 60.

    We are using following code.
    =================

    YahooAPTClient aptClient = new YahooAPTClient(username, password, license, accountID, endPoint, version);

    TargetingAttributeType?[] dimensionList = aptClient.TargetingDictionaryService.getSupportedTargetingAttributeTypes();
    TargetingAttributeValue[] valueList = aptClient.TargetingDictionaryService.getTargetingAttributes(TargetingAttributeTy
    pe.AdSize, true, 0, 344);

    Placement pc = new Placement();
    pc.adAttributes = new AdAttributes();

    pc.adAttributes.adSizeIDs = new long?[] { valueList[0].ID };
    pc.accountID = accountID;
    pc.startDate = DateTime.Now;
    pc.startDateSpecified = true;
    pc.contentTargetingAttributes = new ContentTargetingAttributes();
    Inventory inv = aptClient.InventorySearchService.searchInventory(pc, null, null, null, null, false);
    =========================
    Call to searchInventory(..) is giving us error
    "A required field is missing or empty: placementTarget. "
    Now to solve this error we added following code before calling searchInventory(..) API
    ==============
    pc.contentTargetingAttributes.placementTarget = new PlacementTarget();
    pc.contentTargetingAttributes.placementTarget.ID = "234343"; // What should be value for this ID?
    pc.contentTargetingAttributes.placementTarget.type = PlacementTargetType.SelfManagedPublisher;
    pc.contentTargetingAttributes.placementTarget.typeSpecified = true;
    Inventory inv = aptClient.InventorySearchService.searchInventory(pc, null, null, null, null, false);
    ================
    Our problem now is what should be value of following
    pc.contentTargetingAttributes.placementTarget.ID = "234343"; // What should be value for this ID?
    From where to get placementTargetID ?

    Are we using the right API, can anyone help or is there any sample on using InventorySearchService.searchInventory(...) API.

    hi

    I think we need to add account id of self managed publisher.
    0
  • QUOTE (dadi @ Jul 22 2011, 02:26 AM) <{POST_SNAPBACK}>
    hi

    I think we need to add account id of self managed publisher.

    You can search for the account by AccountService.searchForAccount().
    get the account id and add it to PlacementTarget id.
    0
This forum is locked.

Recent Posts

in General - APT