Hi Peter,

I am trying to do a similar thing. Take an existing shopping campaign and 
duplicate it exactly (different name) within the same account.

I have done the adgroups and campaign creation, but am confused by what I 
do / do not need to specify when adding the product partition to the ad 
groups. Please see my method below. I would appreciate it if you were able 
to shed some light on this.

1) Retrieve all AdGroupCriterion in my adgroup with CriteriaType 
"PRODUCT_PARTITION", fields downloaded: "AdGroupId", "CpcBid", 
"CriteriaType", "PartitionType", "CaseValue"
2) Extract the root criterion like so:

    foreach ($partitions as $partition)
    {
      if ($partition->criterion->parentCriterionId == "")
      {
        $adGroupId = $partition->adGroupId;
        $roots[$adGroupId] = $partition;
      }
    }

3) Add the partition to the adgroup:

  $oldPartition = root criterion found above;

  $service  = $user->GetService("AdGroupCriterionService", ADWORDS_VERSION);
  $adGroupCriterion = new BiddableAdGroupCriterion();
  $adGroupCriterion->adGroupId = $adGroup->getId();

  $adGroupCriterion->criterion = $oldPartition->criterion;
  $adGroupCriterion->criterion->id = -1;

  $adGroupCriterion->biddingStrategyConfiguration = 
    $oldPartition->biddingStrategyConfiguration;
  $adGroupCriterion->criterionUse = "BIDDABLE";
  $adGroupCriterion->AdGroupCriterionType = "BiddableAdGroupCriterion";

  $operation = new AdGroupCriterionOperation();
  $operation->operand = $adGroupCriterion;
  $operation->operator = "ADD";

4) When I perform the mutation I get the 
error: PRODUCT_PARTITION_SUBDIVISION_REQUIRES_OTHERS_CASE

Many thanks,
Phil


On Friday, June 10, 2016 at 4:32:09 AM UTC+1, Peter Oliquino wrote:
>
> Hi Sophie,
>
> Temporary ids are used initially when creating a ProductPartition 
> <https://developers.google.com/adwords/api/docs/reference/v201605/AdGroupCriterionService.ProductPartition>,
>  
> the API then assigns real ids to replace the temporary ids and reflects 
> them in the response. More details regarding partitioning in this link 
> <https://developers.google.com/adwords/api/docs/guides/shopping#partitioning>.
>  
> Additionally, you can refer to this example 
> <https://developers.google.com/adwords/api/docs/samples/java/shopping-campaigns#add-product-partition-tree>
>  in 
> adding/creating ProductPartition trees. You can specify a different 
> adGroupId if you wish to recreate the structure for another adGroup. 
> Examples for other languages could be found here 
> <https://developers.google.com/adwords/api/docs/clientlibraries>.
>
> I hope this helps and please let us know if you still encounter any issues.
>
> Thanks,
> Peter
> AdWords API Team
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords 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 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/393780be-aa82-4cc5-b3dc-f6c220446b41%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to