Hello,

I am using this 'Get Account Hierarchy' script: 
https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy

What I want is to see the full account hierarchy of accounts to which I 
have access with my authenticated email address. This script should show me 
1) direct access accounts 2) manager accounts 3) sub manager accounts. The 
above script successfully shows me accounts to which I have direct access. 
However, it throws the below error on manager accounts:

"
Request made: ClientCustomerId: 3351472384, Host: 
googleads.googleapis.com:443, Method: 
/google.ads.googleads.v6.services.GoogleAdsService/Search, RequestId: 
yd0tvbMgYRXSdHe0a4GL1g, IsFault: True, FaultMessage: User doesn't have 
permission to access customer. Note: If you're accessing a client customer, 
the manager's customer id must be set in the 'login-customer-id' header. 
See 
https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid

Request with ID 'yd0tvbMgYRXSdHe0a4GL1g' failed with status 
'PERMISSION_DENIED' and includes the following errors:
Error with message 'User doesn't have permission to access customer. Note: 
If you're accessing a client customer, the manager's customer id must be 
set in the 'login-customer-id' header. See 
https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid
'.
An exception has occurred, use %tb to see the full traceback.
"

I'm not clear on why the error message is that I "don't have permission to 
access customer." even though I can access this customer via the Google Ads 
online UI. I understand that I could, instead of using the above script as 
it is written, I could make a new google-ads.yaml file per manager account 
and get the sub-accounts that way. But that would be cumbersome. Is there 
not a way to get all the account hierarchy with the above script?
On Monday, March 11, 2019 at 10:38:52 AM UTC-4 Ananth Sakthivel wrote:

> *Finally Fixed the Issue. i just updated the library to the stable 
> version(Google.Ads.GoogleAds). then its working fine.*
> *trim empty space if "LoginCustomerId" has.  *
>
> [image: 2019-03-11_20-06-38.png]
>
>
> On Monday, 11 March 2019 15:08:10 UTC+5:30, pe...@meetweet.nl wrote:
>>
>> Hi Sai,
>>
>> A week ago I sent you my credential information and response data in a 
>> private message.
>> Any progress on this issue?
>>
>> Regards,
>> Peter
>>
>> Op woensdag 13 februari 2019 12:47:25 UTC+1 schreef Ananth Sakthivel:
>>>
>>> since yesterday my code was working fine and it's fetching the 
>>> AdsAccount Details through the Service of "GetCustomer()". but today 
>>> onwards its stop working and throwing the Below error,
>>>
>>> *Google.Ads.GoogleAds.Lib.GoogleAdsException*
>>> *  HResult=0x80131500*
>>> *  Message=Status(StatusCode=PermissionDenied, Detail="The caller does 
>>> not have permission")*
>>> *  Source=Google.Api.Gax.Grpc*
>>>
>>> I have already added the "LoginCustomerId" in my config file. but still, 
>>> it's not sorted out.
>>>
>>> My TestManager CustomerID: 2349150893 <(234)%20915-0893>
>>> Developer token:XXXXXXXXXXXXXX
>>> *please have a look on my code below, also I attached the screenshot of 
>>> my errors.*
>>>
>>>  try
>>>             {
>>>                 Client = new GoogleAdsClient();
>>>                 CustomerService = 
>>> Client.GetService(Services.V0.CustomerService);               
>>>                 GoogleAdsServiceClient googleAdsService = 
>>> Client.GetService(Services.V0.GoogleAdsService);
>>>                     SearchGoogleAdsRequest request = new 
>>> SearchGoogleAdsRequest()
>>>                     {
>>>                         Query = @"SELECT customer_client.client_customer 
>>> FROM customer_client",
>>>                         CustomerId = Client.Config.LoginCustomerId
>>>                     };
>>>                     PagedEnumerable<SearchGoogleAdsResponse, 
>>> GoogleAdsRow> searchPagedResponse = googleAdsService.Search(request);
>>>                     object sync = new Object();
>>>                        
>>>                 Parallel.ForEach(searchPagedResponse, response =>
>>>                 {
>>>                      lock (sync)
>>>                      {
>>>                          var ClientDetails = 
>>> CustomerService.GetCustomer(response.CustomerClient.ClientCustomer);//Error 
>>> at this line
>>>                          if (!ClientDetails.Manager.Value)
>>>                          {
>>>                             
>>>                          }
>>>                      }
>>>
>>>                 });
>>>             }
>>>
>>> [image: 2019-02-13_17-12-10.png]
>>>
>>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 
"AdWords API and Google Ads 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/0ae11bb7-c2ac-48f2-813e-c1de4126cf6fn%40googlegroups.com.

Reply via email to