ProductPartitionTree partitionTree = ProductPartitionTree
.createAdGroupTree(adWordsServices, adWordsSession, adGroupId);
System.out.printf("Original tree:%n%s%n", partitionTree);
ProductPartitionNode rootNode = partitionTree.getRoot().asSubdivision();
rootNode.addChild(ProductDimensions.createOfferId(pogId.toString()))
.asBiddableUnit().setBid(bidAmount);
AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices
.get(adWordsSession, AdGroupCriterionServiceInterface.class);
java.util.List<AdGroupCriterionOperation> mutateOperations = partitionTree
.getMutateOperations();
if (mutateOperations.isEmpty()) {
System.out
.println("Skipping the mutate call because the original tree and the current tree "
+ "are logically identical.");
} else {
adGroupCriterionService.mutate(mutateOperations
.toArray(new AdGroupCriterionOperation[0]));
}
<soapenv:Header>
<ns1:clientCustomerId>34534634643</ns1:clientCustomerId>
<ns1:developerToken>segsegsegrhgerher</ns1:developerToken>
<ns1:userAgent>gergerger (AwApi-Java, AdWords-Axis/2.10.0, Common-Java/2.10.0, Axis/1.4, Java/1.7.0_95, maven)</ns1:userAgent>
<ns1:validateOnly>false</ns1:validateOnly>
<ns1:partialFailure>false</ns1:partialFailure>
</ns1:RequestHeader>
</soapenv:Header>
<soapenv:Body>
<operations>
<operator>ADD</operator>
<adGroupId>26675539979</adGroupId>
<criterion xsi:type="ns2:ProductPartition">
<id>-1</id>
<partitionType>SUBDIVISION</partitionType>
</criterion>
</operand>
</operations>
<operations>
<operator>ADD</operator>
<adGroupId>26675539979</adGroupId>
<criterion xsi:type="ns3:ProductPartition">
<id>-2</id>
<partitionType>UNIT</partitionType>
<parentCriterionId>-1</parentCriterionId>
<caseValue xsi:type="ns3:ProductOfferId">
<value>112431</value>
</caseValue>
</criterion>
</operand>
</operations>
</mutate>
</soapenv:Body>
</soapenv:Envelope>
2016-03-15 18:34:14 WARN soapXmlLogger:85 - SOAP Response:
<soap:Header>
<requestId>00052e1608b322880a4c4d66e60dfa75</requestId>
<serviceName>AdGroupCriterionService</serviceName>
<methodName>mutate</methodName>
<operations>2</operations>
<responseTime>118</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[RequiredError.REQUIRED @ operations[1].operand.biddingStrategyConfiguration, AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE @ operations; 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}']</faultstring>
<detail>
<message>[RequiredError.REQUIRED @ operations[1].operand.biddingStrategyConfiguration, AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE @ operations; 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}']</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<fieldPath>operations[1].operand.biddingStrategyConfiguration</fieldPath>
<trigger/>
<errorString>RequiredError.REQUIRED</errorString>
<ApiError.Type>RequiredError</ApiError.Type>
<reason>REQUIRED</reason>
</errors>
<fieldPath>operations</fieldPath>
<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}</trigger>
<errorString>AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE</errorString>
<ApiError.Type>AdGroupCriterionError</ApiError.Type>
<reason>PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE</reason>
</errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>