Hi Michael,
AgeRanges use fixed criteria IDs. Rather than setting the age range you
want, you need to look up the correct ID associated with that age range and
set that.
Here<https://github.com/googleads/googleads-java-lib/blob/master/examples/adwords_axis/src/main/java/adwords/axis/v201402/targeting/AddDemographicTargetingCriteria.java>is
a Java example of setting up a NegativeAdGroupCriterion (although the
process should be similar for NegativeCampaignCriterion) using an AgeRange.
You can look up the IDs for various AgeRanges and other values in the
documentation <https://developers.google.com/adwords/api/docs/appendix/ages>
.
Regards,
Mike, AdWords API Team
On Monday, April 28, 2014 7:08:16 PM UTC-4, Michael Klein wrote:
>
> I am creating a campaign using the Adwords API, and then trying to
> configure it so that users with UNDETERMINED ages don't see the ads. I get
> an error when I try to do this.
>
> Here is the code I am using:
>
> CampaignCriterionServiceInterface criterionService =
> services.get(session, CampaignCriterionServiceInterface.class);
> AgeRange ageRange = new AgeRange();
> ageRange.setAgeRangeType(AgeRangeAgeRangeType.AGE_RANGE_UNDETERMINED);
>
> NegativeCampaignCriterion criterion = new NegativeCampaignCriterion();
> criterion.setCriterion(ageRange);
> criterion.setCampaignId(campaignId);
>
> CampaignCriterionOperation operation = new
> CampaignCriterionOperation();
> operation.setOperand(criterion);
> operation.setOperator(Operator.ADD);
>
> CampaignCriterionOperation[] operations = new
> CampaignCriterionOperation[] {operation};
> criterionService.mutate(operations);
>
> Here is the error:
>
> [RequiredError.REQUIRED @ operations[0].operand.criterion.id]
>
> It seems that the id on the criterion is required, but I don't have an id
> since I'm trying to create this criterion. Is this supported through the
> API?
>
> Thanks,
>
> Michael
>
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.