Thank you!

But I have next issue. 
I have AdGroupOperations with negative temporari IDs. I create SUBDIVISION, 
ProductID dimension and Others Partitions. I send AdGroup and Partition 
opeartions at one job. When I try to create Partitions I receive following 
ERRORS:
2018-06-27 13:39:59.625  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Operation [0] - SUCCESS
2018-06-27 13:39:59.625  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Operation [1] - FAILURE
2018-06-27 13:39:59.625 ERROR 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Processing error : 
errorType=AdGroupCriterionError, 
trigger=ProductPartition{id=TempCriterionId{id=1}, bidSimulatorStatus=null, 
partitionType=SUBDIVISION, parentCriterionId=null, productGroup=null, 
productGroupObsoleteStatus=null, caseValue=null, decisionPath=[], 
salesCountry=null, merchantId=null, hasPromotedSuggestion=null}, 
errorString=AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE,
 
fieldPath=operations[1].operand
2018-06-27 13:39:59.625  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     : Sending group results 
GroupResult(pdid=ProductPartition{id=TempCriterionId{id=1}, 
bidSimulatorStatus=null, partitionType=SUBDIVISION, parentCriterionId=null, 
productGroup=null, productGroupObsoleteStatus=null, caseValue=null, 
decisionPath=[], salesCountry=null, merchantId=null, 
hasPromotedSuggestion=null}, status=FAIL)
2018-06-27 13:39:59.630  INFO 23531 --- [pool-2-thread-1] 
o.s.i.codec.kryo.CompositeKryoRegistrar  : registering [40, java.io.File] 
with serializer org.springframework.integration.codec.kryo.FileSerializer
2018-06-27 13:39:59.651  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Operation [2] - FAILURE
2018-06-27 13:39:59.651 ERROR 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Processing error : 
errorType=RequiredError, trigger=, errorString=RequiredError.REQUIRED, 
fieldPath=operations[2].operand.biddingStrategyConfiguration
2018-06-27 13:39:59.651 ERROR 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Processing error : 
errorType=AdGroupCriterionError, 
trigger=ProductPartition{id=TempCriterionId{id=1}, bidSimulatorStatus=null, 
partitionType=SUBDIVISION, parentCriterionId=null, productGroup=null, 
productGroupObsoleteStatus=null, caseValue=null, decisionPath=[], 
salesCountry=null, merchantId=null, hasPromotedSuggestion=null}, 
errorString=AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE,
 
fieldPath=operations[2].operand
2018-06-27 13:39:59.651  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     : Sending group results 
GroupResult(pdid=ProductPartition{id=TempCriterionId{id=1}, 
bidSimulatorStatus=null, partitionType=SUBDIVISION, parentCriterionId=null, 
productGroup=null, productGroupObsoleteStatus=null, caseValue=null, 
decisionPath=[], salesCountry=null, merchantId=null, 
hasPromotedSuggestion=null}, status=FAIL)
2018-06-27 13:39:59.651  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Operation [3] - FAILURE
2018-06-27 13:39:59.651 ERROR 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Processing error : 
errorType=RequiredError, trigger=, errorString=RequiredError.REQUIRED, 
fieldPath=operations[3].operand.biddingStrategyConfiguration
2018-06-27 13:39:59.651 ERROR 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     :   Processing error : 
errorType=AdGroupCriterionError, 
trigger=ProductPartition{id=TempCriterionId{id=1}, bidSimulatorStatus=null, 
partitionType=SUBDIVISION, parentCriterionId=null, productGroup=null, 
productGroupObsoleteStatus=null, caseValue=null, decisionPath=[], 
salesCountry=null, merchantId=null, hasPromotedSuggestion=null}, 
errorString=AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE,
 
fieldPath=operations[3].operand
2018-06-27 13:39:59.651  INFO 23531 --- [pool-2-thread-1] 
d.p.m.a.service.service.GroupService     : Sending group results 
GroupResult(pdid=ProductPartition{id=TempCriterionId{id=1}, 
bidSimulatorStatus=null, partitionType=SUBDIVISION, parentCriterionId=null, 
productGroup=null, productGroupObsoleteStatus=null, caseValue=null, 
decisionPath=[], salesCountry=null, merchantId=null, 
hasPromotedSuggestion=null}, status=FAIL)


It seems like this 3 Partitions not linked beetwen each others.

My code:
    /**
     * 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 Root Subdivision --------------------------
            // Create AdGroupCriterionOperation.
            ProductPartition rootPartition = new ProductPartition();
            
rootPartition.setPartitionType(ProductPartitionType.SUBDIVISION);
            rootPartition.setId(adGroup.getId());

            // 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);

            // --- Create Product Dimensions ----------------------
            ProductOfferId dimensionType = 
ProductDimensions.createOfferId(adGroup.getName());
            ProductOfferId emptyDimensionType = new ProductOfferId();

            // --- Create Product ID UNIT --------------------------
            ProductPartition productNode = new ProductPartition();
            productNode.setPartitionType(ProductPartitionType.UNIT);
            productNode.setCaseValue(dimensionType);
            productNode.setParentCriterionId(rootPartition.getId());

            // 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 Others UNIT --------------------------
            ProductPartition emptyNode = new ProductPartition();
            emptyNode.setPartitionType(ProductPartitionType.UNIT);
            emptyNode.setCaseValue(emptyDimensionType);
            emptyNode.setParentCriterionId(rootPartition.getId());

            // 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);

            // Add to list.
            adGroupCriterionOperations.add(rootOperation);
            adGroupCriterionOperations.add(productOperation);
            adGroupCriterionOperations.add(emptyOperation);
        });
        return adGroupCriterionOperations;
    }


Best regards

среда, 27 июня 2018 г., 9:37:42 UTC+3 пользователь Dannison Yao (AdWords 
API Team) написал:
>
> Hi,
>
> After creating your ProductPartition 
> <https://developers.google.com/adwords/api/docs/reference/v201806/AdGroupCriterionService.ProductPartition>
>  object, 
> you have to set this criterion to a BiddableAdGroupCriterion 
> <https://developers.google.com/adwords/api/docs/reference/v201806/AdGroupCriterionService.BiddableAdGroupCriterion>
>  object. 
> After this, you need to add the BiddableAdGroupCriterion object to an 
> AdGroupCriterionOperation 
> <https://developers.google.com/adwords/api/docs/reference/v201806/AdGroupCriterionService.AdGroupCriterionOperation#top_of_page>
>  object. 
> Refer to the sample Java code below for reference.
>
>          // Create AdGroupCriterionOperation.
>         ProductPartition rootPartition = new ProductPartition();
>         rootPartition.setPartitionType(ProductPartitionType.SUBDIVISION);
>
>     // Create BiddableAdGroupCriterion.
>         BiddableAdGroupCriterion biddableAdGroupCriterion = new 
> BiddableAdGroupCriterion();
>         biddableAdGroupCriterion.setAdGroupId(newAdGroupId);
>         biddableAdGroupCriterion.setCriterion(productPartition);
>
>     // Create AdGroupCriterionOperation.
>         AdGroupCriterionOperation operation = new 
> AdGroupCriterionOperation();
>         operation.setOperand(biddableAdGroupCriterion);
>         operation.setOperator(Operator.ADD);
>
>     // Add to list.
>         adGroupCriteriaOperations.add(operation);
>
> You can follow the guide 
> <https://developers.google.com/adwords/api/docs/samples/java/campaign-management#add-a-campaign-using-batchjobservice>
>  provided 
> (buildAdGroupCriterionOperations() method) on how to add adgroup criterion 
> to a BatchJobService.
>
> 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/8ed3076c-83ff-4e1e-bf1c-f481c26cee06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... Константин Латыпов
    • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
      • ... Константин Латыпов
        • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
          • ... Константин Латыпов
            • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
              • ... Константин Латыпов
                • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Константин Латыпов
                • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Константин Латыпов
                • ... 'Dannison Yao (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Константин Латыпов
                • ... 'Anash P. Oommen (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Константин Латыпов
                • ... 'Anash P. Oommen (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Константин Латыпов
                • ... Константин Латыпов
                • ... Константин Латыпов

Reply via email to