Here's my code
```
        internal string 
GenerateKeywordHistoricalMetricsByKeyword_2(GoogleAdsClient client,
                                                                    string 
ccid,
                                                                    string 
product_url,
                                                                    string 
language,
                                                                    string 
location,
                                                                    string 
network,
                                                                    string 
attribute,
                                                                    string 
adgroup,
                                                                    string 
v,
                                                                    bool 
debug)
        {
            
TraceUtilities.Configure(TraceUtilities.DETAILED_REQUEST_LOGS_SOURCE,
                
$"C:\\logs\\GenerateKeywordHistoricalMetricsByKeyword_2_{Me}_{System.Guid.NewGuid()}_trace.log",
                System.Diagnostics.SourceLevels.All);

            if (debug) Debugger.Launch();
            if (network == "Gcsp") network = "GoogleSearch";

            KeywordPlanIdeaServiceClient keywordPlanIdeaService =
        client.GetService(Services.V18.KeywordPlanIdeaService);

            GenerateKeywordHistoricalMetricsRequest request =
    new GenerateKeywordHistoricalMetricsRequest();
            request.CustomerId = ccid;
            request.Keywords.AddRange(from word in product_url.Split(',') 
select word.Trim());
            request.GeoTargetConstants.AddRange(NamedToId(location));
            request.Language = language;
            request.KeywordPlanNetwork = GetNetwork(network);
            request.IncludeAdultKeywords = false;
            request.HistoricalMetricsOptions = new 
Google.Ads.GoogleAds.V18.Common.HistoricalMetricsOptions()
            {
                IncludeAverageCpc = true
            };
            
//request.AggregateMetrics.AggregateMetricTypes.Add(KeywordPlanAggregateMetricTypeEnum.Types.KeywordPlanAggregateMetricType.Device);
            try
            {
                GenerateKeywordHistoricalMetricsResponse response =
                
keywordPlanIdeaService.GenerateKeywordHistoricalMetrics(request);
                return JsonConvert.SerializeObject(response);
            }
            catch (Exception e)
            {
                return JsonConvert.SerializeObject(e.Message);
            }
        }
```
It fails in the try block. The TraceUtilities call generates an empty file. 
The Exception's e.Message contains
```
"Status(StatusCode=\"PermissionDenied\", Detail=\"The caller does not have 
permission\", DebugException=\"Grpc.Core.Internal.CoreErrorDetailException: 
{\"created\":\"@1729751872.851000000\",\"description\":\"Error received 
from peer 
ipv4:142.250.70.170:443\",\"file\":\"..\\..\\..\\src\\core\\lib\\surface\\call.cc\",\"file_line\":1070,\"grpc_message\":\"The
 
caller does not have permission\",\"grpc_status\":7}\")"
```
I am utterly mystified. What does "The caller does not have permission" 
mean? If it's to do with the login-customer-id, that can be seen in the 
`client` object at `LoginCustomerId` and hold a meaningful value.

-Bruce

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 visit 
https://groups.google.com/d/msgid/adwords-api/c0662dcf-d12f-4982-9caa-a32e8032a09en%40googlegroups.com.

Reply via email to