Product Partition Tree Structure

119 views
Skip to first unread message

Ads Developer

unread,
Aug 21, 2014, 1:39:04 AM8/21/14
to adwor...@googlegroups.com
Hi Team,

I am using AdGroupCriterionServiceInterface to fetch the data related to Product Partition.

I was able to retrieve the following information 
getPartitionType: UNIT
getProductDimensionType: ProductCustomAttribute
getCaseValue:com.google.api.ads.adwords.axis.v201402.cm.ProductCustomAttribute@adf58588
getParentCriterionId:*******
getID:************
getType:PRODUCT_PARTITION

And I was able to link the nodes but I was not able to retrieve the display value of the partition type.
I tried using ConstantDataServiceInterface to get the detailsbut i was not able to get information using the above ids.

Please let me know what is the correct procedure to get the complete product partition tree structure with display names and budget allocated as it is shown in Adwords interface.


Thanks in advance 






Ray Tsang (AdWords API Team)

unread,
Aug 21, 2014, 12:09:35 PM8/21/14
to adwor...@googlegroups.com
Hi,

Was the "value" attribute not being returned?

Thanks!

Ray

Ads Developer

unread,
Aug 22, 2014, 12:48:00 AM8/22/14
to adwor...@googlegroups.com
Hi Ray,

This is the sample code that I am using to get the above output mentioned.

AdGroupCriterionServiceInterface criterionService =  
                                  adWordsServices.get(session,AdGroupCriterionServiceInterface.class);
     Selector selector = new Selector();
     selector.setFields(new String[]{"PartitionType", "Id","ParentCriterionId","CaseValue"});
     Predicate adgrpIdPredicate = new Predicate("AdGroupId",PredicateOperator.EQUALS,a);
     Predicate crTypePredicate = new Predicate("CriteriaType",PredicateOperator.EQUALS,b);
     selector.setPredicates(new Predicate[]{adgrpIdPredicate,crTypePredicate});
     AdGroupCriterionPage get = criterionService.get(selector);
     AdGroupCriterion[] entries = get.getEntries();
     for(int i=0;i<entries.length;i++){    
          System.out.println("ADCRITERIA:"+entries[i].getAdGroupCriterionType());
          System.out.println("AdgrpID:"+entries[i].getAdGroupId());
          System.out.println("USE:"+entries[i].getCriterionUse());        
        }
     if(entries[i].getCriterion().getType().toString().equalsIgnoreCase("PRODUCT_PARTITION")){
     ProductPartition part=(ProductPartition) entries[i].getCriterion();
     System.out.println("getPartitionType:"+part.getPartitionType());
     if(part.getCaseValue()!=null){
           System.out.println("getProductDimensionType:"+part.getCaseValue().getProductDimensionType());
           System.out.println("getCaseValue:"+part.getCaseValue());
     }
     System.out.println("getParentCriterionId:"+part.getParentCriterionId());
     System.out.println("getID:"+part.getId());
     System.out.println("getType:"+part.getType());
     }


 Output contains getCaseValue as com.google.api.ads.adwords.axis.v201402.cm.ProductCustomAttribute@adf58588
 But there is no value attribute.
 
 And how to match this output with Shopping Performance Report as the Shopping Performance Report does not have any criteria ID.

Ads Developer

unread,
Aug 26, 2014, 8:25:46 AM8/26/14
to adwor...@googlegroups.com
Hi Ray,

Any update on this.

mm

unread,
Aug 27, 2014, 4:27:29 PM8/27/14
to adwor...@googlegroups.com
The value is on the subclasses, so you have to determine the type and cast to that class in order to get the value, something like this:

if (part.getCaseValue() instanceof ProductBrand) { 
    ProductBrand pb = (ProductBrand) part.getCaseValue();
    String value = pb.getValue();
} else if (part.getCaseValue() instanceof ProductCanonicalCondition) {
.....
}


HTH -
mm

Ads Developer

unread,
Aug 28, 2014, 1:12:44 AM8/28/14
to adwor...@googlegroups.com
Thanks that answered my question
Reply all
Reply to author
Forward
0 new messages