Python: Google Ads API Error (TargetingIdeaService INVALID_SEARCH_PARAMETERS)
I am trying to access the Google Adwords API, as described in their help-file via following sample code:
from googleads import adwords client = adwords.AdWordsClient.LoadFromStorage() targeting_idea_service = client.GetService('TargetingIdeaService', version='v201809') selector = {'ideaType': 'KEYWORD', 'requestType': 'IDEAS', 'requestedAttributeTypes': ['KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES'], 'paging': {'startIndex': '0', 'numberResults': '100' }, 'searchParameters': [{'xsi_type': 'RelatedToQuerySearchParameter', 'queries': ['cats']}] } page = targeting_idea_service.get(selector) print(page)
However, when I try to call the API, following error occures:
zeep.exceptions.Fault: [TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']
Any idea what could cause this error? In my googleads.yaml file (which is called properly, following parameters are set:
# AdWordsClient configurations adwords: developer_token: client_id: client_secret: refresh_token:
This might be late but this error is because you have not mentioned the client_customer_id in your googleads.yaml. Once you add that there will be no such errors
Thanks. I'd also like to add that client_customer_id should be the one of your test account if you don't have an approved developer token. Otherwise you'll be getting this error. For details about client_customer_id see here.