getting customerId from CustomerService API call

43 views
Skip to first unread message

skunkwerk

unread,
Feb 14, 2015, 5:38:59 PM2/14/15
to adwor...@googlegroups.com
Hi,

I have an adwords user's oauth credentials, and I'm able to successfully make a call to download a report, but I had to hard-code in the customerId as I couldn't figure out how to get it.

The get() method of the CustomerService should return the customer ID, but what are the parameters to pass to it?

I tried a GET request to this URL:
 without any header params or body params, to which it returns "<html><body>No service was found.</body></html>".
I also tried with an Authorization and developerToken defined in the headers, but got the same response.

I also tried the python library, and defined an instance of AdWordsClient, but it's client_customer_id ends up as None.

thanks for the help,
imran

Danial Klimkin

unread,
Feb 16, 2015, 9:47:01 AM2/16/15
to adwor...@googlegroups.com
Hello imran,


The CustomerService.get method has no parameters:


Are you using any of our client libraries?


-Danial, AdWords API Team.

skunkwerk

unread,
Feb 16, 2015, 9:29:38 PM2/16/15
to adwor...@googlegroups.com
thanks for the reply Danial,

I managed to get it working by searching the github repo of the python client for 'CustomerService', as I couldn't find it in the documentation.
Here's what worked:

adwords_client = AdWordsClient(environ.get('ADWORDS_DEVELOPER_TOKEN'), oauth_client, user_agent='your_user_agent_here')
customer = adwords_client.GetService('CustomerService').get()
customer_id = customer['customerId']

regards,
imran
Reply all
Reply to author
Forward
0 new messages