The query now runs, but I'm not sure what I'm getting back. According to the documentation for SearchGoogleAdsResponse <https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.services#google.ads.googleads.v1.services.GoogleAdsRow>, I should get a list of results back. Instead I get
AttributeError: 'GRPCIterator' object has no attribute 'results' Also the total_results_count & field_mask do not seem to exist: AttributeError: 'GRPCIterator' object has no attribute 'total_results_count' AttributeError: 'GRPCIterator' object has no attribute 'field_mask' For the next_page_token I get the value "None" - the only field I am not getting an error. Not clear what is going wrong. How would I go about to see what I'm getting back in this rather opaque SearchGoogleAdsResponse object? It is certainly not as transparent as a simple JSON object where I can quickly check what I'm getting back. Also, how does pagination with the Python library work? I could not find anything about this in the documentation or the examples so far. If I try the "Get Keyword Stats <https://developers.google.com/google-ads/api/docs/samples/get-keyword-stats#python>" example, I get an error in case the ID is of the root manager account (ok - understandable) but if I use a client account ID I get: "User doesn't have permission to access customer.". But with the old AdWords API I can pull data for this account. So is there some additional permission needed? What else could go wrong? Also the various concepts are not very clear: All over you talk about customers, clients and/or accounts - which seem to me like they all are the same object. Are you just not very precise here or what is exactly the difference? Is this documented somewhere? On Wednesday, 3 April 2019 22:26:36 UTC+2, googleadsapi-forumadvisor wrote: > > Hi Marcel, > > You can try using the GoogleAdsService > <https://developers.google.com/google-ads/api/reference/rpc/google.ads.googleads.v1.services#google.ads.googleads.v1.services.GoogleAdsService> > and > set the query to the one that I provided earlier. You can find a similar > API call here > <https://developers.google.com/google-ads/api/docs/samples/get-keyword-stats#python> > . > > 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/03/19 12:21:39 [email protected] <javascript:> wrote: > > 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 [email protected] 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 [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/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 [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/5af560e1-ee45-4a10-9e0c-90e56a1e35bc%40googlegroups.com > > <https://groups.google.com/d/msgid/adwords-api/5af560e1-ee45-4a10-9e0c-90e56a1e35bc%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 [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/293abcc3-667c-4406-9c46-10aaf41ef564%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
