Hi Ryan,
You are right. To avoid this error, you could get the criterionId
corresponding to the root and use that as the parentCriterionId in the next
set of operations. A sample SOAP request is shown below:
<mutate xmlns="https://adwords.google.com/api/adwords/cm/v201809">
<operations>
<operator>ADD</operator>
<operand xmlns:ns2="
https://adwords.google.com/api/adwords/cm/v201809"
xsi:type="ns2:BiddableAdGroupCriterion">
<ns2:adGroupId>*****</ns2:adGroupId>
<ns2:criterion xsi:type="ns2:ProductPartition">
<ns2:id>-1</ns2:id>
<ns2:partitionType>UNIT</ns2:partitionType>
<ns2:parentCriterionId>293946777986</ns2:parentCriterionId>
<ns2:caseValue
xsi:type="ns2:ProductCanonicalCondition">
<ns2:condition>REFURBISHED</ns2:condition>
</ns2:caseValue>
</ns2:criterion>
<ns2:biddingStrategyConfiguration>
<ns2:bids xsi:type="ns2:CpcBid">
<ns2:bid>
<ns2:microAmount>500000</ns2:microAmount>
</ns2:bid>
<ns2:cpcBidSource>CRITERION</ns2:cpcBidSource>
</ns2:bids>
</ns2:biddingStrategyConfiguration>
<ns2:urlCustomParameters>
<ns2:doReplace>true</ns2:doReplace>
</ns2:urlCustomParameters>
</operand>
</operations>
</mutate>
Here is the code snippet for reference :
...
use Google\AdsApi\AdWords\v201806\cm\ProductPartition;
use Google\AdsApi\AdWords\v201806\cm\ProductPartitionType;
...
$operations = [];
$root = new ProductPartition();
$root->setPartitionType(ProductPartitionType::SUBDIVISION);
$root->setId(293946777986);
$refurbishedCondition = new ProductCanonicalCondition();
$refurbishedCondition->setCondition(ProductCanonicalConditionCondition::REFURBISHED);
$refurbishedConditionUnit = ProductPartitions::createUnit($root,
$refurbishedCondition);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroupId,
$refurbishedConditionUnit,
600000
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$adGroupCriterionService = $adWordsServices->get($session,
AdGroupCriterionService::class);
Could you give this a try and let me know if that fixes the issue?
Thanks,
Sreelakshmi, AdWords API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@googlegroups.com.
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/1a0o85g000000000gsl4mg001nda16y64mjecpo74o30c1g68qjee1o%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.