I also need to be able to query the existing campaign negatives, but the 
API doesn't seem to like our call.  Here is how we are doing it:

    final Selector selector = new Selector();
    selector.setFields(new String[] {"Id", "CampaignId", "Keyword"});
    final Predicate idPredicate = new Predicate(
                "CampaignId",
                PredicateOperator.EQUALS,
                new String[] {String.valueOf(campaignId)});
    final Predicate keywordPredicate = new Predicate(
                "CriteriaType",
                PredicateOperator.EQUALS,
                new String[] {"Keyword"});
    final Predicate negativePredicate = new Predicate(
                "CriterionUse",
                PredicateOperator.EQUALS,
                new String[] {"Negative"});
    selector.setPredicates(new Predicate[] {idPredicate, keywordPredicate, 
negativePredicate});


The API returns with this:

[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'Keyword'; 
errorDetails:Keyword, SelectorError.INVALID_PREDICATE_ENUM_VALUE @ 
serviceSelector; trigger:'Keyword'; errorDetails:Keyword, 
SelectorError.INVALID_PREDICATE_FIELD_NAME @ serviceSelector; 
trigger:'CriterionUse'; errorDetails:CriterionUse]

A couple questions:

1. What is the correct way to build the Selector and Predicates, to query 
the campaign negatives?

2. For this case, where do we find the list of valid selector fields?  For 
instance, the API doesn't seem to have a problem with "CriteriaType", but 
the API 
documentation<http://code.google.com/apis/adwords/docs/reference/latest/CampaignCriterionService.CampaignCriterion.html>makes
 it look like we should be passing "CampaignCriterion.Type" instead. 
 Is there a more appropriate page I should be looking at?

3. I see "CriterionUse" in the spec for ad group negatives but not campaign 
negatives.  Looking at the documentation for CampaignCriterionService, what 
path do you take to find this field listed?  I guess this is similar to 
question #2, our team is missing the workflow that helps us understand how 
to know which strings are available for any given call.

4. I am guessing that we shouldn't select "Keyword" in the Selector.  The 
author of our code thought that was how the actual criterion would be 
returned.  We will try without out, since the 
documentation<http://code.google.com/apis/adwords/docs/reference/latest/CampaignCriterionService.CampaignCriterion.html>can
 be interpreted to say that the Criterion object will always be returned.

Thanks for any help,

Jim

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en

Reply via email to