Hi Assaf,

You have two options for this:

1. If ads have served with the sitelinks, then you can use the 
PLACEHOLDER_FEED_ITEM_REPORT 
<https://developers.google.com/adwords/api/docs/appendix/reports#placeholder-feed-item>
 
to see the feed item IDs of the sitelinks that have served with each 
campaign by including the *FeedItemId* and *CampaignId* fields in your 
report request, and filtering to rows where *PlaceholderType* is *1*.

2. If ads have not served with the sitelinks, then you'll have to retrieve 
the CampaignFeed 
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService.CampaignFeed>
 object 
using CampaignFeedService 
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService>,
 
and then inspect the matchingFunction 
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService.CampaignFeed#matchingFunction>
 of 
the returned object to extract the ConstantOperand 
<https://developers.google.com/adwords/api/docs/reference/v201409/CampaignFeedService.ConstantOperand>
 objects 
containing the feed item IDs. This would look something like this in Java:

      Selector selector = new SelectorBuilder()
           .fields("CampaignId", "FeedId", "MatchingFunction", 
"PlaceholderTypes", "Status")
           .equals("CampaignId", "*YOUR_CAMPAIGN_ID**"*)
           .equals("Status", "ENABLED")
           .containsAll("PlaceholderTypes", "1")
           .build();
      // Use CampaignFeedService.get to retrieve the CampaignFeed using the 
above Selector.
      CampaignFeedServiceInterface campaignFeedService = 
adWordsServices.get(session, CampaignFeedServiceInterface.class);
      CampaignFeed campaignFeed = 
campaignFeedService.get(selector).getEntries()[0];

      // Inspect the matchingFunction to get the feed item IDs.
      Function matchingFunction = campaignFeed.getMatchingFunction();
      List<Long> feedItemIds = Lists.newArrayList();
      for (FunctionArgumentOperand operand : 
matchingFunction.getRhsOperand()) {
        ConstantOperand constantOperand = (ConstantOperand) operand;
        feedItemIds.add(constantOperand.getLongValue());
      }
      System.out.printf("Feed ID is %d, ids are: %s%n", 
campaignFeed.getFeedId(), feedItemIds);

Cheers,
Josh, AdWords API Team

On Saturday, January 10, 2015 at 3:29:54 PM UTC-5, assaf wrote:
>
> Hi,
>
> I followed closely with the AddSiteLinks /UpdateSiteLinks examples but 
> still have an issue fully implementing getting campaign site links.
> 1. FeedMappingServiceInterface - Create Map for each FeedMappingID and 
> it's placeholder type.
> 2. FeedItemServiceInterface - Created a list of FeedItemID (called 
> siteLinkItemIDs) that their feedMappingID is of placeholder type 1 (from 
> the Map in #1)
> 3. CampaignFeedServiceInterface - got the Feed ID and matching Function. 
> -> here I got stuck - not sure how to user the Matching function to
>    get the actual site link details .
>
> Is there any example for the "get" implementation? 
>
> Help is greatly appreciated.
>
> This is how far I got:
>
>                            Function f = campaignFeed.getMatchingFunction(); 
> // 
> this is from campaignFeedService
>          
>            RequestContextOperand requestContextOperand = new 
> RequestContextOperand();
>            
>  
> requestContextOperand.setContextType(RequestContextOperandContextType.FEED_ITEM_ID);
>
>             Function feedItemFunction = new Function();
>             feedItemFunction.setLhsOperand(new FunctionArgumentOperand[] 
> {requestContextOperand});
>             feedItemFunction.setOperator(FunctionOperator.IN);
>
>             List<FunctionArgumentOperand> operands = new 
> ArrayList<FunctionArgumentOperand>();
>             for (long feedItemId : siteLinkItemIDs) {
>               ConstantOperand constantOperand = new ConstantOperand();
>               constantOperand.setLongValue(feedItemId);
>               constantOperand.setType(ConstantOperandConstantType.LONG);
>               operands.add(constantOperand);
>             }
>             feedItemFunction.setRhsOperand(operands.toArray(new 
> FunctionArgumentOperand[operands.size()])); 
>                             FunctionOperand feedItemFunctionOperand = new 
> FunctionOperand();
>             feedItemFunctionOperand.setValue(feedItemFunction);
>
>                             Function combinedFunction = new Function();
>             combinedFunction.setOperator(FunctionOperator.AND);
>             combinedFunction.setLhsOperand(
>                 new FunctionArgumentOperand[] {feedItemFunctionOperand});
>
>             CampaignFeed campaignFeed2 = new CampaignFeed();
>             campaignFeed2.setFeedId(feedId);
>             campaignFeed2.setCampaignId(campaignId);
>             campaignFeed2.setMatchingFunction(combinedFunction);
>                             campaignFeed2.setPlaceholderTypes(new int[] 
> {PLACEHOLDER_SITELINKS});
>
>             CampaignFeedOperation operation = new CampaignFeedOperation();
>             operation.setOperand(campaignFeed2);
>             operation.setOperator(Operator.ADD);
>
>
> Thanks for any help.
>
> Assaf
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/43d10943-415e-4e27-8a45-b3c4f37ae062%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to