Hi Tommy,
Thanks for reaching out.
With regard to your question, you may use the get()
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#get>
method of AdGroupCriterionService
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService>
to
retrieve the parentCriterionId
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService.ProductPartition#parentcriterionid>
(which
is the ID of the parent product partition subdivision). You can now use the
returned ID of the parent product partition to add ProductOfferId
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService.ProductOfferId>
.
Please let me know if you have further questions/clarifications.
Regards,
Ejay
Google Ads API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
https://ads-developers.googleblog.com/search/label/google_ads_api
https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
On 05/09/19 04:59:38 adcenterinar...@gmail.com wrote:
Hello,
I've created a product partition with 2 offers this way (it works):
// create subdivision
$operations = [];
$root = ProductPartitions::createSubdivision();
$criterion =
ProductPartitions::asBiddableAdGroupCriterion($adGroup->getId(), $root);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$ean = new ProductOfferId();
$ean->setValue('0000000001');
$eanUnit = ProductPartitions::createUnit($root, $ean);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroup->getId(),
$eanUnit,
10*10000
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$ean = new ProductOfferId();
$ean->setValue('0000000002');
$eanUnit = ProductPartitions::createUnit($root, $ean);
$criterion = ProductPartitions::asBiddableAdGroupCriterion(
$adGroup->getId(),
$eanUnit,
11*10000
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
// Other
$ean = new ProductOfferId();
$eanUnit = ProductPartitions::createUnit($root, $ean);
$criterion = ProductPartitions::asNegativeAdGroupCriterion(
$adGroup->getId(),
$eanUnit
);
$operation = ProductPartitions::createAddOperation($criterion);
$operations[] = $operation;
$adGroupCriterionService->mutate($operations);
Now I want to create a function that adds new ProductOfferId to current
partition, but I don't know how to retrieve the $root element without
creating it again (and without doing a query to read the whole partition).
What is the easiest way to get the root element of a product partition?
Thank you
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/e4dead6c-3125-4169-bc9e-e1be72f62a4e%40googlegroups.com
<https://groups.google.com/d/msgid/adwords-api/e4dead6c-3125-4169-bc9e-e1be72f62a4e%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/180idk0000000000gh5o6u001a6a3ew6cmj4d1h60o30c1g68qjie9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.