Hi there, 

I'm trying to integrate with Google Ads API using the available .NET 
package (Google.Ads.GoogleAds latest version - 19.0.1) on a .NET 8 project.

I'm setting up the API out of the samples provided, and currently getting a 
very generic GRPC error which I'm not able to figure out what is going on.

*Message: *Status(StatusCode="Internal", Detail="Internal error 
encountered.")
*Stacktrace: *   at 
Google.Ads.Gax.Interceptors.StreamingRpcInterceptor`1.MoveNext(CancellationToken
 
cancellationToken)
   at 
Google.Api.Gax.Grpc.AsyncResponseStream`1.MoveNextAsync(CancellationToken 
cancellationToken)
   at 
Google.Ads.GoogleAds.V16.Services.GoogleAdsServiceClient.<>c__DisplayClass32_0.<<SearchStreamAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at Program.<>c.<<<Main>$>b__0_0>d.MoveNext() in xxxx\Program.cs:line 61

The sample application is as follows:

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

var app = builder.Build();

// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
    app.UseSwagger();
    app.UseSwaggerUI();
}

app.UseHttpsRedirection();


app.MapGet("/sample", async () =>
{
      var config = new GoogleAdsConfig() {
         OAuth2Mode = Google.Ads.Gax.Config.OAuth2Flow.APPLICATION,
         DeveloperToken = "xxxx",
         OAuth2ClientId = "xxxx",
         OAuth2ClientSecret = "xxxx",
         LoginCustomerId = "xxxx",
         LinkedCustomerId = "xxxx",
         OAuth2RefreshToken =
            "xxxx"
      };

      // Create a Google Ads client.
      var client = new GoogleAdsClient(config);

      // Create the required service.
      var service =
         client.GetService(Services.V16.GoogleAdsService);

      // Create a query that will retrieve all campaigns.
      var query = $@"SELECT
                            campaign.id,
                            campaign.name,
                            campaign.network_settings.target_content_network
                        FROM campaign
                        ORDER BY campaign.id";

      var request = new SearchGoogleAdsStreamRequest();
      request.Query = query;

      try {

         await service.SearchStreamAsync(request, (response) => {

            foreach (var googleAdsRow in response.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;
      }
      catch (Exception ex) {
         
      }   
})
.WithName("GetSample")
.WithOpenApi();

app.Run();


Is there any other setup needed for GRPC to work as expected?
Would you be able to help me, please?

Much appreciated.


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/cdd90fa4-174f-4d3e-bf2e-84bccc3b6ec9n%40googlegroups.com.

Reply via email to