Do you still need help with this? Here is some example in code from one of
my python scripts
adgroup_criterion_service = client.GetService(
'AdGroupCriterionService', version='v201809')
selector = {
'fields':['ParentCriterionId'],
'predicates':[
{
'field':'AdGroupId',
'operator': 'EQUALS',
'values': adgroup_id
}
]
}
page = adgroup_criterion_service.get(selector)
parent = page['entries'][0]['criterion']
helper = ProductPartitionHelper(adgroup_id)
#root = helper.CreateSubdivision()
for pla in PLAList:
new_product = {
'xsi_type' : 'ProductOfferId',
'value' : ''
}
new_product['value'] = pla
#helper.CreateUnit(self,parent=parent, new_product, 200000)
helper.CreateUnit(parent=parent,value=new_product,bid_amount=20000)
other_products = {
'xsi_type': 'ProductOfferId',
}
#helper.CreateUnit(
# root, other_products)
# Make the mutate request
result = adgroup_criterion_service.mutate(helper.GetOperations())
---
You need to use the adgroup_criterion_service get on the parentcriterionID to
get the tree, then mutate the tree.
I iterate through my list of Ids to add "for pla in PLAList" -- note you cannot
add more than 5000~ in a single mutate -- and there are limits to how large the
tree can be - if you exceed something like 12-13k it will give an exception.
--
Hope this helps you out - it took me a while to understand how to manipulate
these. The example only works for creating the tree, so it errors if you try
to do it where one already exists.
On Sunday, June 9, 2019 at 10:25:27 PM UTC-5, CDG wrote:
>
> Hello there
> I am using the python example to create Product Partition trees
>
> Now
> I want to update the tree, but I always get the error.
>
> --
> 'trigger': None,
> 'errorString': 'AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS',
> 'ApiError.Type': 'AdGroupCriterionError',
> 'reason': 'PRODUCT_PARTITION_ALREADY_EXISTS'
> ---
>
> help me to solve the problem, thanks.
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/30ccb9fa-f6cf-4291-8447-16043ae9419a%40googlegroups.com.