Tuesday, 3 May 2016

Java API, get fields of AdGroupCriterion

Hi all,

I am having some trouble getting the fields of an AdGroupCritrerion object that I have obtain thought a call to AdGroupCriterionService.
In the selector builder I add several fields and if I inspect the object with the debugger there they are indeed but I am unable to get them as they seem to be private attributes and there are no get method to retrieve them.

This is the code
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
   
.fields(
       
AdGroupCriterionField.Id,
        AdGroupCriterionField.FinalUrls,
        AdGroupCriterionField.Status,
        AdGroupCriterionField.KeywordText)
   
.in(AdGroupCriterionField.CriteriaType, "KEYWORD")
   
.equals(AdGroupCriterionField.Status, "ENABLED")
   
.build();
AdGroupCriterionPage page = keywordService.get(selector);
for(AdGroupCriterion keyword: page.getEntries()){
   
System.out.println(keyword.getCriterion().getId());
    System.out.println(((Keyword) keyword.getCriterion()).getText());
   
System.out.println(keyword.getFinalUrls() //What I expected
}

I am confident that there is a way to retrieve those fields, maybe casting to another class like with the getText() line or through another object but I haven't been able to find the way.

I hope I was clear and thank you.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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+unsubscribe@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+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/e671ed0a-1f5b-43fa-8f8d-82186b279097%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment