Product partition error in multi level

56 views
Skip to first unread message

SUBIN P VASU

unread,
Jun 18, 2019, 7:04:24 AM6/18/19
to AdWords API and Google Ads API Forum
Hi,

Following are the request to create a product partition with two level.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <ns1:RequestHeader>
            <ns1:clientCustomerId></ns1:clientCustomerId>
            <ns1:developerToken>REDACTED</ns1:developerToken>
            <ns1:userAgent>unknown (AwApi-PHP, googleads-php-lib/37.1.0, PHP/5.6.40)</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <ns1:mutate>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:id>-1</ns1:id>
                        <ns1:partitionType>SUBDIVISION</ns1:partitionType>
                    </ns1:criterion>
                </ns1:operand>
            </ns1:operations>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:id>-2</ns1:id>
                        <ns1:partitionType>SUBDIVISION</ns1:partitionType>
                        <ns1:parentCriterionId>-1</ns1:parentCriterionId>
                        <ns1:caseValue xsi:type="ns1:ProductChannel">
                            <ns1:ProductDimension.Type>CHANNEL</ns1:ProductDimension.Type>
                            <ns1:channel>online</ns1:channel>
                        </ns1:caseValue>
                    </ns1:criterion>
                </ns1:operand>
            </ns1:operations>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:partitionType>UNIT</ns1:partitionType>
                        <ns1:parentCriterionId>-1</ns1:parentCriterionId>
                        <ns1:caseValue xsi:type="ns1:ProductBrand">
                            <ns1:value>class</ns1:value>
                        </ns1:caseValue>
                    </ns1:criterion>
                    <ns1:biddingStrategyConfiguration>
                        <ns1:bids xsi:type="ns1:CpcBid">
                            <ns1:bid>
                                <ns1:microAmount>100000</ns1:microAmount>
                            </ns1:bid>
                        </ns1:bids>
                    </ns1:biddingStrategyConfiguration>
                </ns1:operand>
            </ns1:operations>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:partitionType>UNIT</ns1:partitionType>
                        <ns1:parentCriterionId>-1</ns1:parentCriterionId>
                        <ns1:caseValue xsi:type="ns1:ProductBrand"/>
                    </ns1:criterion>
                    <ns1:biddingStrategyConfiguration>
                        <ns1:bids xsi:type="ns1:CpcBid">
                            <ns1:bid>
                                <ns1:microAmount>100000</ns1:microAmount>
                            </ns1:bid>
                        </ns1:bids>
                    </ns1:biddingStrategyConfiguration>
                </ns1:operand>
            </ns1:operations>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:partitionType>UNIT</ns1:partitionType>
                        <ns1:parentCriterionId>-2</ns1:parentCriterionId>
                        <ns1:caseValue xsi:type="ns1:ProductChannel">
                            <ns1:ProductDimension.Type>CHANNEL</ns1:ProductDimension.Type>
                            <ns1:channel>local</ns1:channel>
                        </ns1:caseValue>
                    </ns1:criterion>
                    <ns1:biddingStrategyConfiguration>
                        <ns1:bids xsi:type="ns1:CpcBid">
                            <ns1:bid>
                                <ns1:microAmount>100000</ns1:microAmount>
                            </ns1:bid>
                        </ns1:bids>
                    </ns1:biddingStrategyConfiguration>
                </ns1:operand>
            </ns1:operations>
            <ns1:operations>
                <ns1:operator>ADD</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId></ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:ProductPartition">
                        <ns1:partitionType>UNIT</ns1:partitionType>
                        <ns1:parentCriterionId>-2</ns1:parentCriterionId>
                        <ns1:caseValue xsi:type="ns1:ProductChannel">
                            <ns1:ProductDimension.Type>CHANNEL</ns1:ProductDimension.Type>
                        </ns1:caseValue>
                    </ns1:criterion>
                    <ns1:biddingStrategyConfiguration>
                        <ns1:bids xsi:type="ns1:CpcBid">
                            <ns1:bid>
                                <ns1:microAmount>100000</ns1:microAmount>
                            </ns1:bid>
                        </ns1:bids>
                    </ns1:biddingStrategyConfiguration>
                </ns1:operand>
            </ns1:operations>
        </ns1:mutate>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



This is the error I'm getting.

Fatal error: Uncaught exception 'Google\AdsApi\AdWords\v201809\cm\ApiException' with message '[DistinctError.DUPLICATE_TYPE @ operations[4].operand.criterion.caseValue; trigger:'ProductChannel{type=CHANNEL, value=null}', DistinctError.DUPLICATE_TYPE @ operations[5].operand.criterion.caseValue; trigger:'ProductChannel{type=CHANNEL, value=null}', AdGroupCriterionError.PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE @ operations; trigger:'ProductPartition{id=TempCriterionId{id=2}, bidSimulatorStatus=null, partitionType=SUBDIVISION, parentCriterionId=TempCriterionId{id=1}, productGroup=null, productGroupObsoleteStatus=null, caseValue=ProductChannel{type=CHANNEL, value=null}, decisionPath=[ProductChannel{type=CHANNEL, value=null}], salesCountry=null, merchantId=null, hasPromotedSuggestion=null}']' in C:\wamp64\www\peral\vendor\googleads\googleads-php-lib\src\Google\AdsApi\Common\Util\Reflection.php on line 43


I'm stuck with this issue for a week. lot of trials and worked nothing. I just checked the smpale file from github and it's getting errors too.
I need this as early as possible.

Thanks in advance.

Sample code, in php, will be appreciated greatly.
NB: account id and adgroup id removed from the log.
/**Code*/*/

$root = ProductPartitions::createSubdivision();
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId, $root);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;   
                               
                $node = ProductPartitions::createSubdivision();
                $node->setParentCriterionId($root->getId());
                $node->setCaseValue(new ProductChannel(ProductDimensionType::CHANNEL,'online'));               
//                $node->setType('CUSTOM_ATTRIBUTE_0');
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId, $node);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;   
               
                //root begin
                $cheapBrand = new ProductBrand();
        $cheapBrand->setValue('class');
        $cheapBrandUnit = ProductPartitions::createUnit($root, $cheapBrand);
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId,$cheapBrandUnit,100000);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;               
       
        $otherCondition = ProductPartitions::createUnit($root, new ProductBrand(null));
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId,$otherCondition, 100000);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;               
                //root end
                               
                //node begin               
                $cheapBrand = new ProductChannel();
        $cheapBrand->setChannel('local');
                $cheapBrand->setProductDimensionType(ProductDimensionType::CHANNEL);
        $cheapBrandUnit = ProductPartitions::createUnit($node, $cheapBrand);
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId,$cheapBrandUnit,100000);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;
               
                $otherCondition = ProductPartitions::createUnit($node, new ProductChannel(ProductDimensionType::CHANNEL,null));
        $criterion = ProductPartitions::asBiddableAdGroupCriterion($adGroupId,$otherCondition, 100000);
        $operation = ProductPartitions::createAddOperation($criterion);
        $operations[] = $operation;               
                //node end 
               

Google Ads API Forum Advisor Prod

unread,
Jun 18, 2019, 3:23:45 PM6/18/19
to subin...@gmail.com, adwor...@googlegroups.com
Hello Subin, 

Thank you for sharing the logs. Based on the logs shared, it looks like you're initially creating two SUBDIVISIONs and then adding the UNITs. Please note that a subdivision introduces a new level in the tree, while units are leaves of the tree. It looks like you are adding one SUBDIVISION followed by another. The next level in the tree should be added to the UNIT and not to the SUBDIVISION. Please find the attached SOAP logs generated by running the code samples. Could you please take a look and let me know if you have any issues?

Regards,
Bharani, Google Ads API Team 

ref:_00D1U1174p._5001UBnvJg:ref
Sample_Logs.rtf

SUBINPVASU

unread,
Jun 19, 2019, 4:17:19 AM6/19/19
to adsapifor...@gmail.com, adwor...@googlegroups.com
Hi,

I'm still in doubts.

Please have a look into this.
Thanks in Advance.


<ns1:id>-6</ns1:id>

<ns1:partitionType>UNIT</ns1:partitionType>
<ns1:parentCriterionId>-1</ns1:parentCriterionId>
<ns1:caseValue xsi:type="ns1:ProductBrand">
<ns1:value>class</ns1:value>
</ns1:caseValue>
</ns1:criterion>
<ns1:biddingStrategyConfiguration>
<ns1:bids xsi:type="ns1:CpcBid">
<ns1:bid>
<ns1:microAmount>100000</ns1:microAmount>
</ns1:bid>
</ns1:bids>
</ns1:biddingStrategyConfiguration>
</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
<ns1:adGroupId></ns1:adGroupId>
<ns1:criterion xsi:type="ns1:ProductPartition">
<ns1:id>-3</ns1:id>

<ns1:partitionType>UNIT</ns1:partitionType>
<ns1:parentCriterionId>-1</ns1:parentCriterionId>
<ns1:caseValue xsi:type="ns1:ProductBrand"/>
</ns1:criterion>
<ns1:biddingStrategyConfiguration>
<ns1:bids xsi:type="ns1:CpcBid">
<ns1:bid>
<ns1:microAmount>100000</ns1:microAmount>
</ns1:bid>
</ns1:bids>
</ns1:biddingStrategyConfiguration>
</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
<ns1:adGroupId></ns1:adGroupId>
<ns1:criterion xsi:type="ns1:ProductPartition">
<ns1:id>-2</ns1:id>
<ns1:partitionType>SUBDIVISION</ns1:partitionType>
<ns1:parentCriterionId>-1</ns1:parentCriterionId>
<ns1:caseValue xsi:type="ns1:ProductCustomAttribute">
<ns1:type>CUSTOM_ATTRIBUTE_0</ns1:type>
<ns1:value>School</ns1:value>
</ns1:caseValue>
</ns1:criterion>

</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
<ns1:adGroupId></ns1:adGroupId>
<ns1:criterion xsi:type="ns1:ProductPartition">
<ns1:id>-4</ns1:id>

<ns1:partitionType>UNIT</ns1:partitionType>
<ns1:parentCriterionId>-2</ns1:parentCriterionId>
<ns1:caseValue xsi:type="ns1:ProductCustomAttribute">
<ns1:type>CUSTOM_ATTRIBUTE_1</ns1:type>

</ns1:caseValue>
</ns1:criterion>
<ns1:biddingStrategyConfiguration>
<ns1:bids xsi:type="ns1:CpcBid">
<ns1:bid>
<ns1:microAmount>100000</ns1:microAmount>
</ns1:bid>
</ns1:bids>
</ns1:biddingStrategyConfiguration>
</ns1:operand>
</ns1:operations>
<ns1:operations>
<ns1:operator>ADD</ns1:operator>
<ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
<ns1:adGroupId></ns1:adGroupId>
<ns1:criterion xsi:type="ns1:ProductPartition">
<ns1:id>-5</ns1:id>

<ns1:partitionType>UNIT</ns1:partitionType>
<ns1:parentCriterionId>-2</ns1:parentCriterionId>
<ns1:caseValue xsi:type="ns1:ProductCustomAttribute">
<ns1:type>CUSTOM_ATTRIBUTE_2</ns1:type>

</ns1:caseValue>
</ns1:criterion>
<ns1:biddingStrategyConfiguration>
<ns1:bids xsi:type="ns1:CpcBid">
<ns1:bid>
<ns1:microAmount>100000</ns1:microAmount>
</ns1:bid>
</ns1:bids>
</ns1:biddingStrategyConfiguration>
</ns1:operand>
</ns1:operations>
</ns1:mutate>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>



Response :

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201809">
<requestId>00058ba8cf24ce010a6237c32300afb3</requestId>
<serviceName>AdGroupCriterionService</serviceName>
<methodName>mutate</methodName>
<operations>6</operations>
<responseTime>231</responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>[AdGroupCriterionError.PRODUCT_PARTITION_REQUIRES_SAME_DIMENSION_TYPE_AS_SIBLINGS @ operations; trigger:'com.google.ads.api.serviceimpls.campaignmgmt.criterion.adgroupcriterion.ProductPartitionTree$Node@39f78ded']</faultstring>
<detail>
<ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201809">
<message>[AdGroupCriterionError.PRODUCT_PARTITION_REQUIRES_SAME_DIMENSION_TYPE_AS_SIBLINGS @ operations; trigger:'com.google.ads.api.serviceimpls.campaignmgmt.criterion.adgroupcriterion.ProductPartitionTree$Node@39f78ded']</message>
<ApplicationException.Type>ApiException</ApplicationException.Type>
<errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError">
<fieldPath>operations</fieldPath>
<fieldPathElements>
<field>operations</field>
</fieldPathElements>
<trigger>com.google.ads.api.serviceimpls.campaignmgmt.criterion.adgroupcriterion.ProductPartitionTree$Node@39f78ded</trigger>
<errorString>AdGroupCriterionError.PRODUCT_PARTITION_REQUIRES_SAME_DIMENSION_TYPE_AS_SIBLINGS</errorString>
<ApiError.Type>AdGroupCriterionError</ApiError.Type>
<reason>PRODUCT_PARTITION_REQUIRES_SAME_DIMENSION_TYPE_AS_SIBLINGS</reason>
</errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>



I’m protected online with Avast Free Antivirus. Get it here — it’s free forever.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
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 adwords-api...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/Eg9GC000000000000000000000000000000000000000000000PTB76V0028tRibyPROmbDJLKbUAqHQ%40sfdc.net.


--
subinpvasu
9495546474
Reply all
Reply to author
Forward
0 new messages