We are in process of migrating code from Ad Words to Google Ads. First step from this is to get all customers which are assigned to for logged in user. For this Ad Words has an API called "CustomerServiceInterface.getCustomers" method which returns all customers at once.

But in Google Ads, there doesn't seem to be similar method. All we could find was get-account-hierarchy

Looking at the code, it is getting all child accounts by recursion method.

This has a major performance bottleneck as it has to iterate over all accessible customers first and then recursively over all manager and their children.

Question for the experts here - is there any efficient way I can get all customers at once? At least can we get all managers accessible to logged in user?

We did find a relevant article - https://groups.google.com/g/adwords-api/c/UHWxe7ag7zI. But that seems to talk about API quota rather than performance.

I am using .net client library to access google ads API using C# .NET.

I have configured 'Installed App' account in following order:

  1. Configured Manager Account for Developer Token.
  2. Created oAuth credentials using Manager Account and developer console
  3. Created test manager account (test Account isn't linked to Ads account).
  4. Enabled Ads API from Ads Console.
  5. Placed configuration in App.Config

App.Config configuration:

    <add key = 'OAuth2Mode' value = 'APPLICATION' />     <add key = 'OAuth2ClientId' value = 'OAUTH-CLIENT-ID' />     <add key = 'OAuth2ClientSecret' value = 'SECRET' />     <add key = 'OAuth2RefreshToken' value = 'REFRESH-TOKEN' />     <add key="DeveloperToken" value="DEV-TOKEN" /> 

I got refresh token from adwords client-library OAuthTokenGenerator.exe using Test account.

Here is my code to access Ads API:

 public static void GetCampaigns(GoogleAdsClient client, long customerId)  {       client.Config.LinkedCustomerId = customerId.ToString();       GoogleAdsServiceClient googleAdsService = client.GetService(Services.V9.GoogleAdsService);       string query = @"SELECT                             campaign.id,                             campaign.name,                             campaign.network_settings.target_content_network                         FROM campaign                         ORDER BY campaign.id";             try             {                 // Issue a search request.                 googleAdsService.SearchStream(customerId.ToString(), query,                     delegate (SearchGoogleAdsStreamResponse resp)                     {                         foreach (GoogleAdsRow googleAdsRow in resp.Results)                         {                             Console.WriteLine("Campaign with ID {0} and name '{1}' was found.",                                 googleAdsRow.Campaign.Id, googleAdsRow.Campaign.Name);                         }                     }                 );             }             catch (GoogleAdsException e)             {                 Console.WriteLine("Failure:");                 Console.WriteLine($"Message: {e.Message}");                 Console.WriteLine($"Failure: {e.Failure}");                 Console.WriteLine($"Request ID: {e.RequestId}");                 throw;             }         } 

However i am receiving this exception on calling API:

 Status(StatusCode="Unauthenticated", Detail="Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1643028386.159000000","description":"Error received from peer ipv4:142.250.181.106:443","file":"..\..\..\src\core\lib\surface\call.cc","file_line":1070,"grpc_message":"Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}") 

can anyone guide me what am i missing in this configuration?

I have always referred to Adwords API. now that google is about to deprecate it i'm trying to migrate to google ads api.
I am using keywords_performance_report
I have been looking at the mapping google is providing:
LabelIds- Select label.resource_name from the resource ad_group_label
I'm using keyword_view resource for all the other data.
how can I combine these 2 resources in one query?

I want to deploy working python project in pycharm to aws lambda. The project is using google-ads library to get some report data from google ads.

I tried deploying lambda by importing complete project as a zip file by zipping all the folders/files inside the project and not the project folder itself. But i got the following error:

{ "errorMessage": "Unable to import module 'main': cannot import name 'cygrpc' from 'grpc._cython' (/var/task/grpc/_cython/__init__.py)", "errorType": "Runtime.ImportModuleError", "stackTrace": [] } 

Assuming that google-ads library is working and that something is wrong with grpc(btw google-ads includes grpcio and stuff on its own), i tried to create a layer for grpcio, cython, cygrpc but the error remains same.

I create projects/layers in aws lambda and they work. I dont know what i am doing wrong here.

Any help would be really appreciated!

versions: google-ads-14.1.0, python-3.9, grpcio-1.43.0