Here is the SOAP log:









[2018-09-24 09:59:58,399 - googleads.soap - INFO] Request made: Service: 
"TargetingIdeaService" Method: "get" URL: 
"https://adwords.google.com/api/adwords/o/v201802/TargetingIdeaService";

[2018-09-24 09:59:58,399 - googleads.soap - DEBUG] Outgoing request: {
'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 
'authorization': 'REDACTED'}

<soap-env:Envelope xmlns:soap-env=
"http://schemas.xmlsoap.org/soap/envelope/";>

  <soap-env:Header>

    <ns0:RequestHeader xmlns:ns0=
"https://adwords.google.com/api/adwords/o/v201802";>

      <ns1:developerToken xmlns:ns1=
"https://adwords.google.com/api/adwords/cm/v201802";>VlozeYU4eXsESV5bWUaQSA<
/ns1:developerToken>

      <ns2:userAgent xmlns:ns2="https://adwords.google.com/api/adwords/cm/
v201802">unknown (AwApi-Python, googleads/14.1.0, Python/3.6.3, 
zeep)</ns2:userAgent>

      <ns3:validateOnly xmlns:ns3="https:
//adwords.google.com/api/adwords/cm/v201802">false</ns3:validateOnly>

      <ns4:partialFailure xmlns:ns4=
"https://adwords.google.com/api/adwords/cm/v201802";>false<
/ns4:partialFailure>

    </ns0:RequestHeader>

  </soap-env:Header>

  <soap-env:Body>

    <ns0:get xmlns:ns0="https://adwords.google.com/api/adwords/o/v201802";>

      <ns0:selector>

        <ns0:searchParameters 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="ns0:RelatedToQuerySearchParameter">

          <ns0:queries>space cruise</ns0:queries>

        </ns0:searchParameters>

        <ns0:ideaType>KEYWORD</ns0:ideaType>

        <ns0:requestType>IDEAS</ns0:requestType>

        <ns0:requestedAttributeTypes>KEYWORD_TEXT<
/ns0:requestedAttributeTypes>

        <ns0:requestedAttributeTypes>SEARCH_VOLUME</ns0:
requestedAttributeTypes>

        <ns0:requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES<
/ns0:requestedAttributeTypes>

        <ns0:paging>

          <ns1:startIndex xmlns:ns1="https://adwords.google.com/api/adwords/
cm/v201802">0</ns1:startIndex>

          <ns2:numberResults xmlns:ns2="https:
//adwords.google.com/api/adwords/cm/v201802">100</ns2:numberResults>

        </ns0:paging>

      </ns0:selector>

    </ns0:get>

  </soap-env:Body>

</soap-env:Envelope>



[2018-09-24 09:59:58,927 - googleads.soap - DEBUG] Incoming response: 

b'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>\n  
<soap:Header>\n    <ResponseHeader 
xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201802"; 
xmlns="https://adwords.google.com/api/adwords/o/v201802";>\n      
<ns2:requestId>000576a014c2e8600aa35c0a9b05e67e</ns2:requestId>\n      
<ns2:serviceName>TargetingIdeaService</ns2:serviceName>\n      
<ns2:methodName>get</ns2:methodName>\n      
<ns2:operations>1</ns2:operations>\n      
<ns2:responseTime>147</ns2:responseTime>\n    </ResponseHeader>\n  
</soap:Header>\n  <soap:Body>\n    <soap:Fault>\n      
<faultcode>soap:Server</faultcode>\n      
<faultstring>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS 
@ selector.searchParameters.searchParameters[0]; 
trigger:\'RelatedToQuerySearchParameter\']</faultstring>\n      <detail>\n 
       <ApiExceptionFault 
xmlns="https://adwords.google.com/api/adwords/o/v201802"; 
xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201802";>\n          
<ns2:message>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS 
@ selector.searchParameters.searchParameters[0]; 
trigger:\'RelatedToQuerySearchParameter\']</ns2:message>\n          
<ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>\n 
         <ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="TargetingIdeaError">\n            
<ns2:fieldPath>selector.searchParameters.searchParameters[0]</ns2:fieldPath>\n 
           <ns2:fieldPathElements>\n              
<ns2:field>selector</ns2:field>\n            </ns2:fieldPathElements>\n     
       <ns2:fieldPathElements>\n              
<ns2:field>searchParameters</ns2:field>\n            
</ns2:fieldPathElements>\n            <ns2:fieldPathElements>\n             
 <ns2:field>searchParameters</ns2:field>\n              
<ns2:index>0</ns2:index>\n            </ns2:fieldPathElements>\n            
<ns2:trigger>RelatedToQuerySearchParameter</ns2:trigger>\n            
<ns2:errorString>TargetingIdeaError.INVALID_SEARCH_PARAMETERS</ns2:errorString>\n
 
           <ns2:ApiError.Type>TargetingIdeaError</ns2:ApiError.Type>\n     
       <reason>INVALID_SEARCH_PARAMETERS</reason>\n          </ns2:errors>\n 
       </ApiExceptionFault>\n      </detail>\n    </soap:Fault>\n  
</soap:Body>\n</soap:Envelope>\n'

[2018-09-24 09:59:58,928 - googleads.soap - WARNING] Error summary: {
'faultMessage': "[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ 
selector.searchParameters.searchParameters[0]; 
trigger:'RelatedToQuerySearchParameter']", 'requestId': 
'000576a014c2e8600aa35c0a9b05e67e', 'serviceName': 'TargetingIdeaService', 
'methodName': 'get', 'operations': '1', 'responseTime': '147'}

Traceback (most recent call last):

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/common.py"
, line 1377, in MakeSoapRequest

    *packed_args, _soapheaders=soap_headers)['body']['rval']

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zeep/proxy.py"
, line 42, in __call__

    self._op_name, args, kwargs)

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py"
, line 132, in send

    return self.process_reply(client, operation_obj, response)

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py"
, line 194, in process_reply

    return self.process_error(doc, operation)

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py"
, line 299, in process_error

    detail=fault_node.find('detail'))

zeep.exceptions.Fault: [TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ 
selector.searchParameters.searchParameters[0]; trigger:
'RelatedToQuerySearchParameter']



During handling of the above exception, another exception occurred:



Traceback (most recent call last):

  File "keyword_planner.py", line 94, in <module>

    main(adwords_client, int(AD_GROUP_ID) if AD_GROUP_ID.isdigit() else None
)

  File "keyword_planner.py", line 68, in main

    page = targeting_idea_service.get(selector)

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/common.py"
, line 1389, in MakeSoapRequest

    e.detail, errors=error_list, message=e.message)

googleads.errors.GoogleAdsServerFault: 
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS 
@ selector.searchParameters.searchParameters[0]; trigger:
'RelatedToQuerySearchParameter']



On Friday, September 21, 2018 at 2:54:03 PM UTC-6, Teja Makani wrote:
>
> Hello Cameron, 
>
> The TargetingIdeaError.INVALID_ <http://targetingideaerror.invalid_/>
> SEARCH_PARAMETERS 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.TargetingIdeaError#reason>
>  error 
> occurs when a SearchParameter 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.SearchParameter.html>
>  does 
> not match the IdeaType 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.IdeaType.html>
>  specified 
> in the TargetingIdeaSelector 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.TargetingIdeaSelector.html>
>  or 
> is otherwise invalid. Looks like you are trying to run 
> get_keyword_ideas.py 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogleads%2Fgoogleads-python-lib%2Fblob%2Fcd707dc897b93cf1bbb19355f7424e7834e7fb55%2Fexamples%2Fadwords%2Fv201802%2Foptimization%2Fget_keyword_ideas.py&sa=D&sntz=1&usg=AFQjCNHCMgT9_b2i2A37vkPJITCbuwAr9A>.
>  
> I ran the same example commenting out the optional lines and able to fetch 
> the results for keyword ideas. Even I ran your code and it works fine. If 
> the problem persists could you please share the SOAP logs(request and 
> response) without redacting any information. Please follow the instruction 
> shown in this README.md 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogleads%2Fgoogleads-python-lib%2Fblob%2Fmaster%2FREADME.md%23how-do-i-log-soap-interactions&sa=D&sntz=1&usg=AFQjCNGDShwQmdIkMz6CwV69dZPRZdbyVg>
>  file 
> to enable logging. 
>
> Regards,
> Sai Teja, AdWords API Team.
>
> On Friday, September 21, 2018 at 3:12:28 PM UTC-4, Cameron Warren wrote:
>>
>> Running code to pull data from the TargetingIdeaService SOAP api. I'm 
>> using the example exactly as written of the google github repository (see 
>> code below).
>>
>> Oauth and everything else working fine. Here is the error:
>>
>> suds.WebFault: Server raised fault: 
>> '[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ 
>> selector.searchParameters.searchParameters[0]; 
>> trigger:'RelatedToQuerySearchParameter']'
>>
>>
>>
>> If anyone know's what's going on here - you're help is greatly 
>> appreciated!
>>
>>
>>
>>
>> AD_GROUP_ID = None
>> PAGE_SIZE = 100
>>
>> def main(client, ad_group_id=None):
>>   # Initialize appropriate service.
>>   targeting_idea_service = client.GetService(
>>       'TargetingIdeaService', version='v201802')
>>
>>   # Construct selector object and retrieve related keywords.
>>   selector = {
>>       'ideaType': 'KEYWORD',
>>       'requestType': 'IDEAS'
>>   }
>>
>>   selector['requestedAttributeTypes'] = [
>>       'KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES']
>>
>>   offset = 0
>>   selector['paging'] = {
>>       'startIndex': str(offset),
>>       'numberResults': str(PAGE_SIZE)
>>   }
>>
>>   selector['searchParameters'] = [{
>>       'xsi_type': 'RelatedToQuerySearchParameter',
>>       'queries': ['baseball']
>>   }]
>>
>>   # # Language setting (optional).
>>   # selector['searchParameters'].append({
>>   #     # The ID can be found in the documentation:
>>   #     # 
>> https://developers.google.com/adwords/api/docs/appendix/languagecodes
>>   #     'xsi_type': 'LanguageSearchParameter',
>>   #     'languages': [{'id': '1000'}]
>>   # })
>>
>>   # # Network search parameter (optional)
>>   # selector['searchParameters'].append({
>>   #     'xsi_type': 'NetworkSearchParameter',
>>   #     'networkSetting': {
>>   #         'targetGoogleSearch': True,
>>   #         'targetSearchNetwork': False,
>>   #         'targetContentNetwork': False,
>>   #         'targetPartnerSearchNetwork': False
>>   #     }
>>   # })
>>
>>   # # Use an existing ad group to generate ideas (optional)
>>   # if ad_group_id is not None:
>>   #   selector['searchParameters'].append({
>>   #       'xsi_type': 'SeedAdGroupIdSearchParameter',
>>   #       'adGroupId': ad_group_id
>>   #   })
>>
>>   more_pages = True
>>   while more_pages:
>>     page = targeting_idea_service.get(selector)
>>
>>     # Display results.
>>     if 'entries' in page:
>>       for result in page['entries']:
>>         attributes = {}
>>         for attribute in result['data']:
>>           attribute_value = attribute['value']
>>           if 'value' in attribute_value:
>>             attributes[attribute['key']] = attribute_value['value']
>>           else:
>>             attributes[attribute['key']] = []
>>         print ('Keyword with "%s" text and average monthly search volume '
>>                '"%s" was found with Products and Services categories: %s.'
>>                % (attributes['KEYWORD_TEXT'],
>>                   attributes['SEARCH_VOLUME'],
>>                   attributes['CATEGORY_PRODUCTS_AND_SERVICES']))
>>       print
>>     else:
>>       print 'No related keywords were found.'
>>     offset += PAGE_SIZE
>>     selector['paging']['startIndex'] = str(offset)
>>     more_pages = offset < int(page['totalNumEntries'])
>>
>>
>> if __name__ == '__main__':
>>   # Initialize client object.
>>   adwords_client = adwords.AdWordsClient.LoadFromStorage()
>>
>>   main(adwords_client)
>>
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/2f899963-56cb-4246-b675-b2918a103e1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to