Hi Anthony

Thanks for getting back. I've tried the CustomerClientService with Python

service = client.get_service('CustomerClientService')
query = ('SELECT customer_client.resource_name,'
                'customer_client.client_customer,'
                'customer_client.level, customer_client.hidden,'
                'customer_client.level'
                'FROM customer_client');
response = service.search(root_account_id, query=query, page_size=100)

Where root_account_id is the ID of the root level MCC account. But I get

AttributeError: 'CustomerClientServiceClient' object has no attribute 
'search'

Is this the right service? If not, what service should be used?

Regards Marcel

On Monday, 1 April 2019 23:24:05 UTC+2, googleadsapi-forumadvisor wrote:
>
> Hi Marcel,
>
> To get the account hierarchy via Google Ads API, you could use the 
> customer_client 
> <https://developers.google.com/google-ads/api/docs/fields/customer_client> 
> resource. 
> Through which you can get only the resource name, level, Boolean value of 
> hidden status and Client_customer details of the accounts under your 
> manager account. To get these details the OAuth credentials used to make 
> the API call should be of manager account and the ClientCustomerId passing 
> in the header should be of manager account. Below is the sample query for 
> your reference. 
>
> Please note that, you have to iterate through all the customers to get the 
> descriptive_name.
>
> query = ('SELECT customer_client.resource_name,
>                 customer_client.client_customer,
>                 customer_client.level, customer_client.hidden,
>                 customer_client.level
>                 FROM customer_client');
>
> Please let me know if you have any further questions.
>
> Regards,
> Anthony
> 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 04/01/19 10:55:22 marce...@d1-solutions.com <javascript:> wrote:
>
> Hi
>
> We're in the process of migrating from AdWords API to the new Google Ads 
> API. Our Python tool currently loops over all accounts under the MCC root 
> account and downloads various reports for all accounts on a daily basis.
>
> From what I understand, we also have to place calls for each account again 
> with the Google Ads API. Therefore, we also need to know all accounts under 
> the root level MCC account, but I'm already struggling with this.
>
> In the AdWords API we would do something like this: I would use 
> ManagedCustomerService.get(selector) with an appropriate selector and then 
> loop over the pages (see also here 
> <https://developers.google.com/adwords/api/docs/guides/accounts-overview#managedcustomerservice>)
>  
> to get all accounts under the root MCC.
>
> How would I do this with the new Google Ads API? The Python examples 
> <https://github.com/googleads/google-ads-python/> do not (yet) show how 
> to do this. Or is there a better way to pull reports over all accounts, 
> which are not managed accounts?
>
> FYI: Credentials & token are working (we're using the same tokens as 
> before for AdWords [see here 
> <https://developers.google.com/google-ads/api/docs/migration/carryover>]) 
> and I can successfully pull the accessible customers 
> via customer_service.list_accessible_customers().
>
> -- 
> -- 
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
> 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/0d7a3c7e-4fc9-47d0-8628-7fca4889dcde%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/adwords-api/0d7a3c7e-4fc9-47d0-8628-7fca4889dcde%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/5af560e1-ee45-4a10-9e0c-90e56a1e35bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Migrati... Marcel Zemp
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Marcel Zemp
        • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
          • ... Marcel Zemp
          • ... Alexander Belozerov
            • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
              • ... cv
                • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
                • ... cv
                • ... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum

Reply via email to