Hi,
I think that I dont understand this: "you should associate your
ProductPartition *Root* to your "Other" case first before adding it in your
BiddableAdGroupCriterion".
I thought that this is association code:
productNode.setParentCriterionId(rootPartition.getId());
But it still not working:
operations.addAll(adGroupOperations);
operations.addAll(buildPartitions(adGroupOperations));
// Use a BatchJobHelper to upload all operations.
BatchJobHelper batchJobHelper = adWordsServices
.getUtility(authService.getSession(), BatchJobHelper.class);
batchJobHelper.uploadBatchJobOperations(operations,
batchJob.getUploadUrl().getUrl());
---------------------------------
/**
* Create Product Partition Operations for provided AdGroupOperations
*
* @param adGroupOperations
* @return
*/
private List<AdGroupCriterionOperation>
buildPartitions(List<AdGroupOperation> adGroupOperations) {
List<AdGroupCriterionOperation> adGroupCriterionOperations = new
LinkedList<>();
adGroupOperations.forEach(adGroupOperation -> {
AdGroup adGroup = adGroupOperation.getOperand();
if (AdGroupStatus.REMOVED.equals(adGroup.getStatus())) {
return;
}
// --- Create Product Dimensions ----------------------
ProductOfferId dimensionType =
ProductDimensions.createOfferId(adGroup.getName());
ProductOfferId emptyDimensionType = new ProductOfferId();
// --- Create Root Subdivision --------------------------
// Create AdGroupCriterionOperation.
ProductPartition rootPartition = new ProductPartition();
rootPartition.setPartitionType(ProductPartitionType.SUBDIVISION);
rootPartition.setId(adGroup.getId());
// --- Create Product ID UNIT --------------------------
ProductPartition productNode = new ProductPartition();
productNode.setPartitionType(ProductPartitionType.UNIT);
productNode.setCaseValue(dimensionType);
productNode.setParentCriterionId(rootPartition.getId());
productNode.setId(adGroup.getId() * 100000 - 1);
// --- Create Others UNIT --------------------------
ProductPartition emptyNode = new ProductPartition();
emptyNode.setPartitionType(ProductPartitionType.UNIT);
emptyNode.setCaseValue(emptyDimensionType);
emptyNode.setParentCriterionId(rootPartition.getId());
emptyNode.setId(adGroup.getId() * 100000 - 2);
// Create BiddableAdGroupCriterion.
BiddableAdGroupCriterion productAdGroupCriterion = new
BiddableAdGroupCriterion();
productAdGroupCriterion.setAdGroupId(adGroup.getId());
productAdGroupCriterion.setCriterion(productNode);
// Create AdGroupCriterionOperation.
AdGroupCriterionOperation productOperation = new
AdGroupCriterionOperation();
productOperation.setOperand(productAdGroupCriterion);
productOperation.setOperator(Operator.ADD);
// Create BiddableAdGroupCriterion.
BiddableAdGroupCriterion emptyAdGroupCriterion = new
BiddableAdGroupCriterion();
emptyAdGroupCriterion.setAdGroupId(adGroup.getId());
emptyAdGroupCriterion.setCriterion(emptyNode);
// Create AdGroupCriterionOperation.
AdGroupCriterionOperation emptyOperation = new
AdGroupCriterionOperation();
emptyOperation.setOperand(emptyAdGroupCriterion);
emptyOperation.setOperator(Operator.ADD);
// Create BiddableAdGroupCriterion.
BiddableAdGroupCriterion biddableAdGroupCriterion = new
BiddableAdGroupCriterion();
biddableAdGroupCriterion.setAdGroupId(adGroup.getId());
biddableAdGroupCriterion.setCriterion(rootPartition);
// Create AdGroupCriterionOperation.
AdGroupCriterionOperation rootOperation = new
AdGroupCriterionOperation();
rootOperation.setOperand(biddableAdGroupCriterion);
rootOperation.setOperator(Operator.ADD);
// Add to list.
adGroupCriterionOperations.add(productOperation);
adGroupCriterionOperations.add(emptyOperation);
adGroupCriterionOperations.add(rootOperation);
});
return adGroupCriterionOperations;
}
Best regards
четверг, 28 июня 2018 г., 11:43:51 UTC+3 пользователь Dannison Yao (AdWords
API Team) написал:
>
> Hi,
>
> According to your logs, you are encountering the error
> RequiredError.REQUIRED
> <https://developers.google.com/adwords/api/docs/common-errors#RequiredError.REQUIRED>,
>
> which means that you have a missing entity that the service you are using
> needs before it executes. Another error you are encountering is the
> PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE
> <https://developers.google.com/adwords/api/docs/reference/v201806/DraftAsyncErrorService.AdGroupCriterionError>
> error
> which is encountered when your subdivision does not have an "others" case.
> Upon investigation of your code, after you have created your root
> subdivision, you immediately added it on your BiddableAdGroupCriterion.
> This is the reason you are encountering the error, you should associate
> your ProductPartition *Root* to your "Other" case first before adding it
> in your BiddableAdGroupCriterion.
>
> Let me know how this goes.
>
> Regards,
> Dannison
> AdWords API Team
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/08b6cdf3-d009-43b2-bd54-0f5ee48fda26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.