Fetch Customer ID programmatically?

190 views
Skip to first unread message

ch...@stylelabs.ca

unread,
Sep 27, 2018, 6:06:33 AM9/27/18
to AdWords API and Google Ads API Forum
I'm still getting used to the Adwords API (using the PHP SDK). I have an authorization workflow and the consenting account's refresh token is stored for later use, along with the client ID/Secret, and Developer key. 
(I do wish this SDK used the same Google_Client object that the other Google APIs used, or that it used the json files generated by the API Console)
I also apparently need a Customer ID to do anything in the system... I find this odd, I guess? The API should already know which user account this is regarding (the one that consented and whose access token is in use). 

We're working on a SaaS system at the moment to allow users to authorize through our site and attach their entered "leads" to a custom targeting list (to an existing list? Or create a new one? Not sure yet), and it seems like forcing them to copy and paste their customer ID from AdWords is an odd extra step... Have I misunderstood something? I don't seem to be able to make calls without that "clientCustomerId" value, though I'd like to be able to automatically pull the most relevant top-level one for that account.

What am I doing wrong? Am I misunderstanding the workflow?

Bharani Cherukuri (AdWords API Team)

unread,
Sep 27, 2018, 3:49:10 PM9/27/18
to AdWords API and Google Ads API Forum
Hello Chris, 

Thank you for explaining the use case. You may use the CustomerService.getCustomers() which takes no arguments and returns the details of the customers directly accessible by the user authenticating the call. Please check this guide as a reference. The client customer Id is required for all other API services except the CustomerService and ReportDefinitionService. The same email address/user can have access to multiple accounts hence the API calls are made depending on the email address used for authentication along with the target account CID. If this does not address your concern, could you please elaborate?

Regards,
Bharani, AdWords API Team

ch...@stylelabs.ca

unread,
Sep 27, 2018, 4:44:04 PM9/27/18
to AdWords API and Google Ads API Forum
That's exactly what I needed; thank you! :)
Reply all
Reply to author
Forward
0 new messages