Hi Matthias,

Yes, I would recommend to use AdGroupCriterionService.get() 
<https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService#get>
 to 
get the ParentCriterionId 
<https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report#parentcriterionid>
 just 
like Kevin have suggested. It is currently not possible to filter the 
ParentCriterionId using the value of 0 or None via Product Partition Report 
<https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report>
.

Let me know if you have further concerns.

Thanks,
Luis
AdWords API Team

On Saturday, October 27, 2018 at 1:13:40 AM UTC+8, Kevin Weitzner wrote:
>
> Hi Matthias,
>
> I went to check this out, as I think I need to do this for my issue.
>
> I was able to get the parent criterion id using the 
> AdGroupCriterionService get selector
>
> Looks like something like this would work - but I've not put it in 
> practice other than a quick test.
>
> def main(client, adgroup_id):
>   """Runs the example."""
>   adgroup_criterion_service = client.GetService(
>       'AdGroupCriterionService', version='v201806')
>
>   selector = {
>     'fields':['ParentCriterionId'],
>       'predicates':[
>           {
>               'field':'AdGroupId',
>               'operator': 'EQUALS',
>               'values': adgroup_id
>           }
>       ]
>   }
>   page = adgroup_criterion_service.get(selector)
>
>   print page['entries'][0]['criterion']['id']
>
>
> It appears that the root partition is the first entry in the list so you can 
> grab it using [0].  You should be able to confirm it - as the 
> page['entries'][0]['criterion']['idparentcriterionId] should be None.
>
>
> On Friday, October 26, 2018 at 10:22:54 AM UTC-5, Matthias Baader wrote:
>>
>> Hi, 
>>
>> if I understand that correctly, you can find the root product group id by 
>> searching for the product group that does not have a parent product id. 
>> Right?
>>
>> But how exactly does the AWQL query in Python have to look like?
>>
>> Is the following code correct?
>>
>>   report_query = (adwords.ReportQueryBuilder()
>>                   .Select('CampaignId', 'AdGroupId', 'Id', 
>> 'ParentCriterionId')
>>                   .From('PRODUCT_PARTITION_REPORT')
>>                   .Where('ParentCriterionId').In(0)#<is this line correct?
>>                   .Build())
>>
>> It seems to work, but I'm struggling with the .In(0) - part, because the 
>> service reference states "Undefined for the root partition": 
>>
>>
>> https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupCriterionService.ProductPartition#parentcriterionid
>>
>> ...whereas the report reference does not mention the root at all:
>>
>> https://developers.google.com/adwords/api/docs/appendix/reports/product-partition-report#parentcriterionid
>>
>> .Where('ParentCriterionId').In(None)
>>
>> ...throws an error.
>>
>> Or would you recommend using the AdGroupCriterionService for this task?
>>
>> Best regards
>> Matthias
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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].
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/85848636-97f0-418a-90aa-ae8d3ad24579%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • ... Matthias Baader
    • ... Kevin Weitzner
      • ... 'Luis Xander Talag (AdWords API Team)' via AdWords API and Google Ads API Forum

Reply via email to