Hello javeed,
Are you adding all of these criteria to the same campaign? It looks like you add each criterion twice and so every other one fails. You can only add each criteria once to the same campaign. Also, please note you don't need to set the AgeRangeType property as it is read-only. The ID in enough to identify the range. -Danial, AdWords API Team. On Tuesday, August 14, 2012 7:07:39 PM UTC+4, javeed wrote: > > Hi, > > When i try to publish or update AgeRange to CampaingCriterionService. I am > getting the following error. > > CriterionError.CANNOT_ADD_CRITERIA_TYPE. > > AgeRange ar1 = new AgeRange(); > > ar1.setId(503001); > ar1.setAgeRangeType(AgeRangeAgeRangeType.AGE_RANGE_18_24); > ageTargets.add(ar1); > > And try to Mutate but for some reason i am having this issue. > > I am trying this in Sandbox. Is there any restrictions in using this. > > Here is the Soap log message > > <operations><operator>ADD</operator><operand > xsi:type="ns2:NegativeCampaignCriterion" xmlns:ns2=" > https://adwords.google.com/api/adwords/cm/v201109"><campaignId>*******</campaignId><criterion > > xsi:type="ns2:AgeRange"><id>503002</id><ageRangeType>AGE_RANGE_25_34</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand><campaignId></campaignId><criterion > > xsi:type="ns3:AgeRange" xmlns:ns3=" > https://adwords.google.com/api/adwords/cm/v201109"><id>503002</id><ageRangeType>AGE_RANGE_25_34</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand > > xsi:type="ns4:NegativeCampaignCriterion" xmlns:ns4=" > https://adwords.google.com/api/adwords/cm/v201109"><campaignId></campaignId><criterion > > xsi:type="ns4:AgeRange"><id>503003</id><ageRangeType>AGE_RANGE_35_44</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand><campaignId></campaignId><criterion > > xsi:type="ns5:AgeRange" xmlns:ns5=" > https://adwords.google.com/api/adwords/cm/v201109"><id>503003</id><ageRangeType>AGE_RANGE_35_44</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand > > xsi:type="ns6:NegativeCampaignCriterion" xmlns:ns6=" > https://adwords.google.com/api/adwords/cm/v201109"><campaignId></campaignId><criterion > > xsi:type="ns6:AgeRange"><id>503004</id><ageRangeType>AGE_RANGE_45_54</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand><campaignId></campaignId><criterion > > xsi:type="ns7:AgeRange" xmlns:ns7=" > https://adwords.google.com/api/adwords/cm/v201109"><id>503004</id><ageRangeType>AGE_RANGE_45_54</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand > > xsi:type="ns8:NegativeCampaignCriterion" xmlns:ns8=" > https://adwords.google.com/api/adwords/cm/v201109"><campaignId></campaignId><criterion > > xsi:type="ns8:AgeRange"><id>503001</id><ageRangeType>AGE_RANGE_18_24</ageRangeType></criterion></operand></operations><operations><operator>ADD</operator><operand><campaignId></campaignId><criterion > > xsi:type="ns9:AgeRange" xmlns:ns9=" > https://adwords.google.com/api/adwords/cm/v201109 > "><id>503001</id><ageRangeType>AGE_RANGE_18_24</ageRangeType></criterion></operand></operations> > > I have got this Exception. > > > <?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap=" > http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><ResponseHeader > xmlns="https://adwords.google.com/api/adwords/cm/v201109"><requestId>0004c73abb159cc80aedd6c300007c02</requestId><serviceName>CampaignCriterionService</serviceName><methodName>mutate</methodName><operations>4</operations><responseTime>422</responseTime><units>4</units></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>[CriterionError.CANNOT_ADD_CRITERIA_TYPE > > @ operations[1].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ operations[3].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ operations[5].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ operations[7].operand.criterion]</faultstring><detail><ApiExceptionFault > xmlns="https://adwords.google.com/api/adwords/cm/v201109"><message>[CriterionError.CANNOT_ADD_CRITERIA_TYPE > > @ operations[1].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ operations[3].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ operations[5].operand.criterion, CriterionError.CANNOT_ADD_CRITERIA_TYPE > @ > operations[7].operand.criterion]</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors > > xsi:type="CriterionError" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"><fieldPath>operations[1].operand.criterion</fieldPath><trigger/><errorString>CriterionError.CANNOT_ADD_CRITERIA_TYPE</errorString><ApiError.Type>CriterionError</ApiError.Type><reason>CANNOT_ADD_CRITERIA_TYPE</reason></errors><errors > > xsi:type="CriterionError" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"><fieldPath>operations[3].operand.criterion</fieldPath><trigger/><errorString>CriterionError.CANNOT_ADD_CRITERIA_TYPE</errorString><ApiError.Type>CriterionError</ApiError.Type><reason>CANNOT_ADD_CRITERIA_TYPE</reason></errors><errors > > xsi:type="CriterionError" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance"><fieldPath>operations[5].operand.criterion</fieldPath><trigger/><errorString>CriterionError.CANNOT_ADD_CRITERIA_TYPE</errorString><ApiError.Type>CriterionError</ApiError.Type><reason>CANNOT_ADD_CRITERIA_TYPE</reason></errors><errors > > xsi:type="CriterionError" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance > "><fieldPath>operations[7].operand.criterion</fieldPath><trigger/><errorString>CriterionError.CANNOT_ADD_CRITERIA_TYPE</errorString><ApiError.Type>CriterionError</ApiError.Type><reason>CANNOT_ADD_CRITERIA_TYPE</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope> > > Its very urgent that we have to put this in production. Please let me know > if am doing any thing wrong. > > -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
