TargetingIdeaService -

30 views
Skip to first unread message

Harshitha

unread,
Feb 28, 2019, 3:33:58 PM2/28/19
to AdWords API and Google Ads API Forum
Currently, I am using the TargetingIdeaService to provide a subset of the functionality of the Keyword Planner by providing a list of locations, language and a RelatedToQuerySearchParameter query to TargetingIdeaService.get to get a list of keywords and their associated data.

My API Version: V201806

But, I am getting the exception like

ex = (com.google.api.ads.adwords.axis.v201806.cm.ApiException) ApiException{applicationExceptionType=ApiException, errors=[TargetingIdeaError{apiErrorType=TargetingIdeaError, errorString=TargetingIdeaError.INVALID_SEARCH_PARAMETERS, fieldPath=selector.searchParameters.searchParameters[0], fieldPathElements=[FieldPathElement{field=selector}, FieldPathElement{field=searchParameters}, FieldPathElement{field=searchParameters, index=0}], reason=INVALID_SEARCH_PARAMETERS, trigger=LanguageSearchParameter}, TargetingIdeaError{apiErrorType=TargetingIdeaError, errorString=TargetingIdeaError.INVALID_SEARCH_PARAMETERS, fieldPath=selector.searchParameters.searchParameters[1], fieldPathElements=[FieldPathElement{field=selector}, FieldPathElement{field=searchParameters}, FieldPathElement{field=searchParameters, index=1}], reason=INVALID_SEARCH_PARAMETERS, trigger=LocationSearchParameter}, TargetingIdeaError{apiErrorType=TargetingIdeaError, errorString=TargetingIdeaError.INVALID_SEARCH_PARAMETERS, fieldPath=selector.searchParameters.searchParameters[2], fieldPathElements=[FieldPathElement{field=selector}, FieldPathElement{field=searchParameters}, FieldPathElement{field=searchParameters, index=2}], reason=INVALID_SEARCH_PARAMETERS, trigger=RelatedToQuerySearchParameter}]}

Kindly look into the code.

 GoogleTokenResponse tokenResp = new GoogleTokenResponse();
            tokenResp.setAccessToken(accDetails.getAccessToken());
            tokenResp.setRefreshToken(accDetails.getRefreshToken());
            gleServices.setAccountDetails(accDetails);
            adWordsSession = gleServices.createAdWordsSession(clientId, clientSecret, tokenResp.getRefreshToken(), developerToken, userAgent);
            TargetingIdeaServiceInterface targetingIdeaService = (TargetingIdeaServiceInterface) gleServices.getService(gleServices.TARGETING_IDEA_SERVICE, adWordsSession);

            TargetingIdeaSelector selector = new TargetingIdeaSelector();
            selector.setRequestType(RequestType.IDEAS);
            selector.setIdeaType(IdeaType.KEYWORD);
            selector.setRequestedAttributeTypes(new AttributeType[]{AttributeType.KEYWORD_TEXT});

            Paging paging = new Paging();
            paging.setStartIndex(0);
            paging.setNumberResults(200);
            selector.setPaging(paging);

            Location loc = new Location();
            loc.setId(Long.valueOf(2356));
            LocationSearchParameter countryTargetSearchParameter = new LocationSearchParameter();
            countryTargetSearchParameter.setLocations(new Location[]{loc});

            Language lang = new Language();
            lang.setId(Long.valueOf(1000));
            LanguageSearchParameter langTargetSearchParameter = new LanguageSearchParameter();
            langTargetSearchParameter.setLanguages(new Language[]{lang});
            
            RateExceededError rateExceeded = new RateExceededError();
            rateExceeded.setRetryAfterSeconds(100);
            Thread.sleep(rateExceeded.getRetryAfterSeconds() * 1000);

            selector.setSearchParameters(new SearchParameter[]{new RelatedToQuerySearchParameter(null, new String[]{"bakery"}), countryTargetSearchParameter, langTargetSearchParameter});

            TargetingIdeaPage page = targetingIdeaService.get(selector);
            targetingIdea = page.getEntries();


Thanks in advance

CONFIDENTIALITY INFORMATION AND DISCLAIMER

This email message and its attachments may contain confidential, proprietary or legally privileged information and is intended solely for the use of the individual or entity to whom it is addressed. If you have erroneously received this message, please delete all copies of it immediately and notify the sender. If you are not the intended recipient of the email message you should not disseminate, distribute or copy this e-mail. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, incomplete or contain viruses and NetElixir accepts no liability for any damage caused by the limitations of the e-mail transmission. Thank you for your cooperation.

googleadsapi...@google.com

unread,
Feb 28, 2019, 6:06:42 PM2/28/19
to AdWords API and Google Ads API Forum
Hi Harshitha,

Could you run this code from the client library and reply back with the SOAP request and response? You may reply privately to author.

Regards,
Dhanya, AdWords API Team
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Reply all
Reply to author
Forward
0 new messages