Moved AdGroup Negative Keywords to bulk and now getting a strange error

29 views
Skip to first unread message

Matthew Macchia

unread,
Dec 7, 2015, 9:23:45 AM12/7/15
to AdWords API Forum
I moved our AdGroup Negative Keywords to a bulk mutation and now i"m getting this error:
Remote Exception - message:Unmarshalling Error: cvc-elt.4.3: Type 'ns2:Operation' is not validly derived from the type definition, 'BulkMutateJobPolicy', of element 'policy'. 

Any notion what is going on here?

This is the rough gist of the code (java). I have a more extensive architecture so it's hard to show.


List<AdGroupCriterionOperation> adGroupOperations = new ArrayList<>();

for (CoiAdGroup coiAdGroup : itemsToCreate) {
List<NegativeKeyword> adGroupKeywords = negativeKeywordService.findByAdGroupId(coiAdGroup.getId());
if (adGroupKeywords != null && !adGroupKeywords.isEmpty()) {
for (NegativeKeyword negativeKeyword : adGroupKeywords) {
if (negativeKeyword.getAdNetworkId() != null) {
continue;
}
AdGroupCriterionOperation operation = addAdGroupNegativeKeywordOperation(negativeKeyword, coiAdGroup);
adGroupOperations.add(operation);
}
}

}
SimpleMutateJob mutateJob = new SimpleMutateJob();
MutateJobServiceInterface batchService = getAdWordsService(mutationRequest.getAccount().getId(), MutateJobServiceInterface.class);
mutateJob = batchService.mutate(operations.toArray(new AdGroupCriterionOperation[adGroupOperations.size()]), new BulkMutateJobPolicy());


private AdGroupCriterionOperation addAdGroupNegativeKeywordOperation(NegativeKeyword negativeKeyword, CoiAdGroup coiAdGroup) {
AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
NegativeAdGroupCriterion adGroupCriterion = new NegativeAdGroupCriterion();
Keyword googlekeyword = new Keyword();
if (negativeKeyword.getAdNetworkId() != null) {
googlekeyword.setId(negativeKeyword.getAdNetworkId());
}
googlekeyword.setText(negativeKeyword.getText());
googlekeyword.setMatchType(convertToGoogleMatchType(negativeKeyword.getMatchType()));
adGroupCriterion.setAdGroupId(coiAdGroup.getAdNetworkId());
adGroupCriterion.setCriterion(googlekeyword);

operation.setOperand(adGroupCriterion);
operation.setOperator(Operator.ADD);
return operation;
}

Anthony Madrigal

unread,
Dec 7, 2015, 4:45:43 PM12/7/15
to AdWords API Forum
Hi Matthew,

Could you possibly share with me your SOAP request and response for this operation? If so, please do so via Reply privately to author.

Thanks,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages