Java API - PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE

67 views
Skip to first unread message

Константин Латыпов

unread,
Jun 11, 2018, 5:28:07 AM6/11/18
to AdWords API and Google Ads API Forum
Hello,

I have empty AdGroup and following code:
        ProductPartitionTree partitionTree =
               
ProductPartitionTree.createAdGroupTree(adWordsServices, session, data.getAdGroupId());

       
ProductPartitionNode partitionNode = partitionTree.getRoot();
       
ProductOfferId emptyDimensionType = new ProductOfferId();
       
ProductOfferId dimensionType = ProductDimensions.createOfferId(data.getProductId());

        partitionNode
           
.asSubdivision()
           
.addChild(emptyDimensionType);

        partitionNode
           
.asSubdivision()
           
.addChild(dimensionType)
           
.setBid(partition.getBid());

       
AdGroupCriterionServiceInterface adGroupCriterionService =
                adWordsServices
.get(session, AdGroupCriterionServiceInterface.class);
       
List<AdGroupCriterionOperation> operations = partitionTree.getMutateOperations();

       
if (operations.isEmpty()) {
            log
.info("Skipping the mutate call because the original tree and the current tree "
                   
+ "are logically identical.");
       
} else {
            adGroupCriterionService
.mutate(
                    operations
.toArray(new AdGroupCriterionOperation[operations.size()]));
       
}

It generates this request
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201802" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>295-001-9695</ns1:clientCustomerId>
            <ns1:developerToken>REDACTED</ns1:developerToken>
            <ns1:userAgent>backend (AwApi-Java, AdWords-Axis/3.15.0, Common-Java/3.15.0, Axis/1.4, Java/1.8.0_171, maven, ProductPartitionTree)</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201802" xsi:type="ns2:BiddableAdGroupCriterion">
                    <ns2:adGroupId>12345</ns2:adGroupId>
                    <ns2:criterion xsi:type="ns2:ProductPartition">
                        <ns2:id>-1</ns2:id>
                        <ns2:partitionType>SUBDIVISION</ns2:partitionType>
                    </ns2:criterion>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201802" xsi:type="ns3:BiddableAdGroupCriterion">
                    <ns3:adGroupId>12345</ns3:adGroupId>
                    <ns3:criterion xsi:type="ns3:ProductPartition">
                        <ns3:id>-2</ns3:id>
                        <ns3:partitionType>UNIT</ns3:partitionType>
                        <ns3:parentCriterionId>-1</ns3:parentCriterionId>
                        <ns3:caseValue xsi:type="ns3:ProductOfferId">
                            <ns3:value>testAd2</ns3:value>
                        </ns3:caseValue>
                    </ns3:criterion>
                    <ns3:biddingStrategyConfiguration>
                        <ns3:bids xsi:type="ns3:CpcBid">
                            <ns3:bid>
                                <ns3:microAmount>30000</ns3:microAmount>
                            </ns3:bid>
                            <ns3:cpcBidSource>CRITERION</ns3:cpcBidSource>
                        </ns3:bids>
                    </ns3:biddingStrategyConfiguration>
                    <ns3:urlCustomParameters>
                        <ns3:doReplace>true</ns3:doReplace>
                    </ns3:urlCustomParameters>
                </operand>
            </operations>
            <operations>
                <operator>ADD</operator>
                <operand xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201802" xsi:type="ns4:BiddableAdGroupCriterion">
                    <ns4:adGroupId>12345</ns4:adGroupId>
                    <ns4:criterion xsi:type="ns4:ProductPartition">
                        <ns4:id>-3</ns4:id>
                        <ns4:partitionType>UNIT</ns4:partitionType>
                        <ns4:parentCriterionId>-1</ns4:parentCriterionId>
                        <ns4:caseValue xsi:type="ns4:ProductOfferId"/>
                    </ns4:criterion>
                    <ns4:urlCustomParameters>
                        <ns4:doReplace>true</ns4:doReplace>
                    </ns4:urlCustomParameters>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

And this responce error:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201802">
            <requestId>00056e3107c457110a371215e70a3b8b</requestId>
            <serviceName>AdGroupCriterionService</serviceName>
            <methodName>mutate</methodName>
            <operations>3</operations>
            <responseTime>188</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>[RequiredError.REQUIRED @ operations[2].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>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201802">
                    <message>[RequiredError.REQUIRED @ operations[2].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>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">
                        <fieldPath>operations[2].operand.biddingStrategyConfiguration</fieldPath>
                        <fieldPathElements>
                            <field>operations</field>
                            <index>2</index>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>operand</field>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>biddingStrategyConfiguration</field>
                        </fieldPathElements>
                        <trigger/>
                        <errorString>RequiredError.REQUIRED</errorString>
                        <ApiError.Type>RequiredError</ApiError.Type>
                        <reason>REQUIRED</reason>
                    </errors>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError">
                        <fieldPath>operations</fieldPath>
                        <fieldPathElements>
                            <field>operations</field>
                        </fieldPathElements>
                        <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>


Tell me please how can I create "Others case" and exclude it?

Best regards.


Bharani Cherukuri (AdWords API Team)

unread,
Jun 11, 2018, 12:18:42 PM6/11/18
to AdWords API and Google Ads API Forum
Hello, 

Thank you for sharing the logs. The PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE error indicates that the subdivided product partitions must have an "others" case. Each subdivision must always be completely partitioned and should have an "Others" category. Please note that each subdivision must contain an "empty" caseValue of the correct type, representing "all other values". Please check this guide for more information. You may see this in the AdWords UI as the "Everything else in...." entry. 

Can you refer to our code sample and add the Others category and let me know if you run into any issues?

Regards,
Bharani, AdWords API Team

Константин Латыпов

unread,
Jun 13, 2018, 8:39:41 AM6/13/18
to AdWords API and Google Ads API Forum
This code works fine:

        ProductPartitionTree partitionTree =
                ProductPartitionTree.createAdGroupTree(adWordsServices, session, data.getAdGroupId());

        ProductPartitionNode partitionNode = partitionTree
                .getRoot()
                .asSubdivision();

        ProductOfferId emptyDimensionType = new ProductOfferId();
        ProductOfferId dimensionType = ProductDimensions.createOfferId(data.getProductId());

        partitionNode
            .addChild(dimensionType)
            .setBid(data.getBid())
            .asBiddableUnit();

        partitionNode
            .addChild(emptyDimensionType)
            .asExcludedUnit();






понедельник, 11 июня 2018 г., 19:18:42 UTC+3 пользователь Bharani Cherukuri (AdWords API Team) написал:

Bharani Cherukuri (AdWords API Team)

unread,
Jun 13, 2018, 12:07:59 PM6/13/18
to AdWords API and Google Ads API Forum
Hello, 

I'm glad that your issue has been resolved. Feel free to write back to us if you have any other questions. 
Reply all
Reply to author
Forward
0 new messages