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;
}
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/41115516-7f96-4801-901e-3e0c8b157b4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.