Hi, Anash P. Oommen

This code will works for ProductPartitionNode
  partitionNode
   .addChild(emptyDimensionType)
   .asExcludedUnit();

And ProductPartition have no method   asExcludedUnit(); It only have: .
setPartitionType(ProductPartitionType.UNIT);   
And this: emptyAdGroupCriterion.setCriterionUse(CriterionUse.NEGATIVE); . 
don't help.

Tell me please how can I add Excluded Other Case?

My code sample:

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

            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 Product ID UNIT --------------------------
           // Create BiddableAdGroupCriterion.
           BiddableAdGroupCriterion productAdGroupCriterion = new 
BiddableAdGroupCriterion();
           productAdGroupCriterion.setAdGroupId(adGroup.getId());
           productAdGroupCriterion.setCriterion(productNode);
          
 
productAdGroupCriterion.setBiddingStrategyConfiguration(adGroup.getBiddingStrategyConfiguration());

            // 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);
          
 
emptyAdGroupCriterion.setBiddingStrategyConfiguration(adGroup.getBiddingStrategyConfiguration());

            // 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(rootOperation);
           adGroupCriterionOperations.add(emptyOperation);
           adGroupCriterionOperations.add(productOperation);
       });
       return adGroupCriterionOperations;
   }



Best regards


среда, 4 июля 2018 г., 4:04:20 UTC+3 пользователь Anash P. Oommen (AdWords 
API Team) написал:
>
> Yep, your code should work.
>
> Cheers
> Anash P. Oommen,
> AdWords API Advisor.
>
> On Tuesday, July 3, 2018 at 11:06:09 AM UTC-4, Константин Латыпов wrote:
>>
>> Thank you.
>>
>> this code fixed issue:
>>   
>> productAdGroupCriterion.setBiddingStrategyConfiguration(adGroup.getBiddingStrategyConfiguration());
>>   
>> emptyAdGroupCriterion.setBiddingStrategyConfiguration(adGroup.getBiddingStrategyConfiguration());
>>
>> But there is last issue (I hope)
>> How can I create exculuded partition?
>>
>> Something like this code for PartitionNode:
>>   partitionNode
>>     .addChild(emptyDimensionType)
>>     .asExcludedUnit();
>>
>>
>> Best regards
>>
>>
>> понедельник, 2 июля 2018 г., 19:24:45 UTC+3 пользователь Anash P. Oommen 
>> (AdWords API Team) написал:
>>>
>>> Hi,
>>>
>>> Could you try a few things?
>>>
>>> 1. You are missing a biddingStrategyConfiguration node in couple of 
>>> operands, could you add them?
>>> 2. Could you make sure the root node appears before the child nodes in 
>>> the operations list?
>>>
>>> Let me know if that doesn't address the issues.
>>>
>>> Cheers
>>> Anash P. Oommen,
>>> AdWords API Team.
>>>
>>> On Monday, July 2, 2018 at 10:39:16 AM UTC-4, Константин Латыпов wrote:
>>>>
>>>> Hi, Dannison
>>>>
>>>> I sent you info via "Reply privately to author" at friday. If you will 
>>>> need any additional info I will be glad to provide it.
>>>>
>>>> Best regards
>>>>
>>>> пятница, 29 июня 2018 г., 10:52:30 UTC+3 пользователь Dannison Yao 
>>>> (AdWords API Team) написал:
>>>>>
>>>>> Hi,
>>>>>
>>>>> My apologies for the back and forth. Could you send me your complete 
>>>>> SOAP request and response logs that was generated when you used this code 
>>>>> you sent in your previous response along with your clientCustomerId so I 
>>>>> could further investigate this? You may send this via *Reply 
>>>>> privately to author*. Could you also set your SOAP XML logger to 
>>>>> *DEBUG* mode?
>>>>>
>>>>> 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/13ddb624-6170-433f-b989-df84819b2cf3%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
    • ... Константин Латыпов
    • ... '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