I have an adwords user's Oauth credentials, and I'm able to successfully make an API 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 in the API 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 like this, but it's client_customer_id variable ends up as None:
from googleads.adwords import AdWordsClient
oauth_client = GoogleRefreshTokenClient(environ.get('GOOGLE_CLIENT_ID'), environ.get('GOOGLE_CLIENT_SECRET'), oauth_record.refresh_token)
adwords_client = AdWordsClient(environ.get('ADWORDS_DEVELOPER_TOKEN'), oauth_client, user_agent='agent'))
customer_id = adwords_client.client_customer_id
print 'customer_id:' + str(customer_id)
Unlike this question, I don't care about adding the user to my MCC account.