To provide more context here, the authorized user account whose credentials I'm using to make the request DOES have direct access to multiple cancelled accounts, but it also has access to an MCC that has many active accounts. Based on my understanding from other support threads and this blog post from last year (https://ads-developers.googleblog.com/2018/03/changes-to-inactive-adwords-accounts.html), the expected behavior would be that all active accounts are returned by this request and cancelled accounts are ignored. Instead, I am getting the error mentioned in my previous post and nothing is returned.
On Friday, November 8, 2019 at 2:18:34 PM UTC-5, Ben Foster wrote: > > > I am trying to list all managed accounts under an MCC, but I am getting a > non-descript "CUSTOMER_NOT_ACTIVE" error. Here is the error: > googleads.errors.GoogleAdsServerFault: > [AuthorizationError.CUSTOMER_NOT_ACTIVE @ ; trigger:'<null>'] > > I have seen several threads on here saying that > ManagedCustomerService.get() should only return active accounts. Here are a > couple examples of those threads: > > https://groups.google.com/forum/#!searchin/adwords-api/customer_not_active$20managedcustomerservice%7Csort:date/adwords-api/euIs6Uhyxn0/wDEMNiLDBQAJ > > https://groups.google.com/forum/#!searchin/adwords-api/customer_not_active$20managedcustomerservice%7Csort:date/adwords-api/Ua4aYCNq5SM/r_Ys7RoIAQAJ > > I have an active MCC under the authorized user account that has many > active accounts. > > Please advise. > > Here is my python code, which uses googleads-python-lib ( > https://github.com/googleads/googleads-python-lib > <https://github.com/googleapis/google-api-python-client>): > > API_VERSION = 'v201809' > MANAGED_CUSTOMER_SERVICE = 'ManagedCustomerService' > PAGE_SIZE = 100 > > def get_managed_accounts(account_id): > oauth2_client = oauth2.GoogleRefreshTokenClient( > g.credentials['client_id'], g.credentials['client_secret'], g.credentials[ > 'refresh_token']) > > adwords_client = adwords.AdWordsClient( > os.environ['GOOGLE_ADS_DEVELOPER_TOKEN'], > oauth2_client, > os.environ['GOOGLE_ADS_USER_AGENT']) > > managed_customer_service = adwords_client.GetService( > MANAGED_CUSTOMER_SERVICE, version=API_VERSION) > > offset = 0 > selector = { > 'fields': ['CustomerId', 'Name','CanManageClients'], > 'paging': { > 'startIndex': str(offset), > 'numberResults': str(PAGE_SIZE) > }, > 'predicates':[{ > 'field': 'ExcludeHiddenAccounts', > 'operator': 'EQUALS', > 'values': ['true'] > }] > } > > response = { > 'accounts':[] > } > > more_pages = True > while more_pages: > # THE ERROR OCCURS WHEN THE FOLLOWING LINE IS EXECUTED > page = managed_customer_service.get(selector) > if 'entries' in page: > accounts = page['entries'] > for account in accounts: > print(account) > if account['customerId'] == int(account_id): > continue > else: > response['accounts'].append({ > 'id': account['customerId'], > 'name': account['name'], > 'canManageClients': account['canManageClients'] > }) > > offset += PAGE_SIZE > selector['paging']['startIndex'] = str(offset) > more_pages = offset < int(page['totalNumEntries']) > > return jsonify(**response) > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/095c9300-ce73-4099-a420-d4c75785826c%40googlegroups.com.
