Hi Stijn, The CustomerService is a service used only to retrieve account specific information. If what you wish is to retrieve information on accounts under a specific hierarchy, you will need to use the ManagedCustomerService <https://developers.google.com/adwords/api/docs/reference/v201806/ManagedCustomerService> instead. You may note that the CanManageClients <https://developers.google.com/adwords/api/docs/reference/v201806/ManagedCustomerService.ManagedCustomer#canmanageclients> field is also supported in the ManagedCustomer <https://developers.google.com/adwords/api/docs/reference/v201806/ManagedCustomerService.ManagedCustomer> object of the ManagedCustomerService.
I hope this helps and feel free to write back if you need further information. Thanks and regards, Peter AdWords API Team On Monday, September 10, 2018 at 1:26:19 PM UTC+8, Stijn van Lieshout wrote: > > I am building an Adwords application with oAuth 2.0 authentication in > python. > > I'm able to retrieve all Adwords accounts associated with a google account > using the *get_accounts* function below. But now I would like to drill > down deeper into the account hierarchy if an account canManageClients (read: > mcc account). > > I've already had a look at the Get account hierarchy under the current > account > <https://developers.google.com/adwords/api/docs/samples/python/account-management#get-the-account-hierarchy-under-the-current-account> > > but there ManagedCustomerService is used whereas I don't manage these > accounts and am using CustomerService instead. > > How to retrieve Adwords accounts under an MCC account using > CustomerService? > > *How I am currently retrieving accounts:* > > from googleads import adwords > > def get_accounts(client): > customer_service = client.GetService('CustomerService', version= > 'v201806') > selector = { > 'fields': ['customerId', 'descriptiveName', 'canManageClients'] > } > accounts = customer_service.getCustomers(selector) > > result = [] > for account in accounts: > customerId = account['customerId'] > name = account['descriptiveName'] > canManageClients = account['canManageClients'] > if canManageClients: > # How to retrieve all accounts under MCC account here? > result.append({"id": customerId, "name": name, "canManageClients": > canManageClients}) > return result > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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/5e70736d-2ad8-4f50-acd7-c5626d6a4d7d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
