How to check whether an account linked to a manager account?

241 views
Skip to first unread message

lsy

unread,
Aug 18, 2022, 4:30:01 PM8/18/22
to Google Ads API and AdWords API Forum
Hello,

I have a mangager account 'A' under one user, a manager accout 'B', and 'B' s client account 'b' under another user. 
My application needs to check whether an account is linked to 'A', if not, send a link request. 

I already linked 'B' to 'A', and now I want to deal with client account 'b'. To check whether 'b' is linked, I checked 'b' 's customer_manager_link, the results is empty, I also checked 'A' 's customer_client_link, the results does not include 'b'.  When I use:

customer_client_link_service.mutate_customer_client_link(customer_id=manager_customer_id, operation=client_link_operation)

to create customer_client_link between 'b' and 'A', I got the following error:
error_code {
    manager_link_error: ALREADY_MANAGED_IN_HIERARCHY
  }
  message: "Client is already managed in hierarchy."


With this situation, how can I know 'b' is already linked and then I will not send link request?

Thanks,
Shiying 

Google Ads API Forum Advisor

unread,
Aug 18, 2022, 10:24:33 PM8/18/22
to lishiy...@gmail.com, adwor...@googlegroups.com

Hi Shiying,


Thank you for reaching out to the Google Ads API team. I hope you are doing well today.
 

When you issue the call to accept the invitation from the manager account, you are supposed to authenticate with the client customer account and this way you won’t encounter the authorization error. As you were authenticated with the manager account, it automatically detected the client customer account that you extended the invitation to, so the "ALREADY_MANAGED_IN_HIERARCHY" error was thrown. When you are inactivating a link make sure the client account is having at-least one user with admin access level if not you will face CLIENT_HAS_NO_ADMIN_USER error. You could refer to this article to give access to a user.
 

If, you still persist with the error, you may provide us with the complete request and response logs, with the request-id so our team further investigate your error you encountered.


You can provide it via Reply privately to the author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2dlMKg:ref

Zweitze

unread,
Aug 22, 2022, 8:03:57 AM8/22/22
to Google Ads API and AdWords API Forum
Hi,

You wrote
 To check whether 'b' is linked, I checked 'b' 's customer_manager_link, the results is empty
and the question is of course how you checked that.

As far as I know, given a customer_id, the API offers no method to find out the managers of that account.
The way to go is to run "customer_client" report of the intended manager - in your case, manager A. For instance
SELECT
    customer_client.status,
    customer_client.id
FROM customer_client

Run this under manager A, then check whether something is returned. Note: In v9 field 'status' does not exist and the report only lists active accounts. (And yes, that may explain why your check failed: the account wasn't active... From v10 on, disabled accounts are also returned.)


A different approach is just to ask a report (any report!) for that account with LoginCustomerId set to the intended manager - in your case that would be A. When you get an error, check the error: if it came because of no access then you can send the link request.
Reply all
Reply to author
Forward
0 new messages