how do i authenticate a adword account id ?

33 views
Skip to first unread message

אייל נעמן

unread,
May 11, 2017, 5:51:34 AM5/11/17
to AdWords API Forum
hi

I want to check if an adword account id really exist. 

because, if I put an id of a real account I get a result, but if, for some reason, I type a wrong id (by mistake), the server crushes… so I would like to prevent that…

Please help.

Tnx, Eyal. 

Sreelakshmi Sasidharan (AdWords API Team)

unread,
May 11, 2017, 1:47:21 PM5/11/17
to AdWords API Forum
Hi Eyal, 

You could use CustomerService.getCustomers() without specifying the clientCustomerId in the request header. This should return all the accounts that the specific login/OAuth credentials has access to. If the account is a manager account, you could then use the MangedCustomerService to get all the client accounts under that manager account. This sample in Java can be referred for the second part of operation using ManagedCustomerService. Once you have the client customer id(s) that are valid, you could use those for subsequent API requests. Samples in other languages can also be found here

If you attempt to make an API call with an incorrect clientCustomerId, the API will return the error : AuthenticationError.CUSTOMER_NOT_FOUND. If this operation is causing your application server to crash, you might want to review the error handling in your application to make sure this error is handled properly. 

Please let me know if you have any further questions. 

Thanks,
Sreelakshmi, AdWords API Team
Reply all
Reply to author
Forward
0 new messages