I figured it out, using the pre-built definitions in the example.

For anybody else who needs to do this in Python - you can build it off this 
-- include the class ProductPartitionHelper - pass it a list of PLA IDs and 
it will create them.   There is probably a better way to do this - but this 
should get you going if you need to segment by ID rather than 
conditions/categories like in the example.


def main(client, adgroup_id, PLAList):
  """Runs the example."""
  adgroup_criterion_service = client.GetService(
      'AdGroupCriterionService', version='v201806')

  helper = ProductPartitionHelper(adgroup_id)
  root = helper.CreateSubdivision()

  for pla in PLAList:
      new_product = {
          'xsi_type' : 'ProductOfferId',
          'value' : ''
      }
      new_product['value'] = pla
      helper.CreateUnit(root, new_product, 200000)

  other_products = {
      'xsi_type': 'ProductOfferId',
  }

  helper.CreateUnit(
      root, other_products)

  # Make the mutate request
  result = adgroup_criterion_service.mutate(helper.GetOperations())



On Friday, October 26, 2018 at 11:54:12 AM UTC-5, Kevin Weitzner wrote:
>
> Additionally -- the end goal is to be able to built it out like the 
> attached image.
>
>
>
>
> On Friday, October 19, 2018 at 9:39:25 AM UTC-5, Kevin Weitzner wrote:
>>
>> Greetings,
>>
>> I'm attempting to modify the add_product_partition_tree.py (
>> https://github.com/googleads/googleads-python-lib/blob/master/examples/adwords/v201806/shopping/add_product_partition_tree.py)
>>  
>> example file to create a product group with a single PLAID - and every 
>> other item to be excluded from that group.
>>
>> Interestingly, the script straight from Github errors -- but I've been 
>> trying to modify it to accomplish what I am looking to do, but no matter 
>> how I approach it, I can't quite figure it out.  
>>
>> Almost any method I use to accomplish this results in the error:
>> googleads.errors.GoogleAdsServerFault: 
>> [AdGroupCriterionError.PRODUCT_PARTITION_ALREADY_EXISTS @ 
>> operations[0].operand.criterion, 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[1].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=1}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[2].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=1}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[3].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=1}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[4].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=2}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[5].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=2}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[6].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=2}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[7].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=3}', 
>> AdGroupCriterionError.PRODUCT_PARTITION_DOES_NOT_EXIST @ 
>> operations[8].operand.criterion.parentCriterionId; 
>> trigger:'TempCriterionId{id=3}']
>>
>> ---
>>
>> From looking at the various posts on the forum, and the java api.. I 
>> think I need to delete all product partitions - and then try to build out 
>> the product partitions .. but I can't find out how to do this using the 
>> python library.  
>>
>> Is there anybody who has a starting point that I can use to make 
>> adjustments on?
>>
>> Thanks,
>> Kevin
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/4563435d-abb0-4a7d-b623-e6f99ffa2f9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... Kevin Weitzner
    • ... 'Sreelakshmi Sasidharan (AdWords API Team)' via AdWords API and Google Ads API Forum
      • ... Kevin Weitzner
        • ... Kevin Weitzner
          • ... 'Sreelakshmi Sasidharan (AdWords API Team)' via AdWords API and Google Ads API Forum
            • ... Kevin Weitzner
              • ... 'Sreelakshmi Sasidharan (AdWords API Team)' via AdWords API and Google Ads API Forum
                • ... Kevin Weitzner
    • ... Kevin Weitzner
      • ... Kevin Weitzner
        • ... 'Sreelakshmi Sasidharan (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to