Hai team,


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 below,


e = (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}]}



Java Code:



 public TargetingIdea[] getClusterCol(ClientAccounts campInfo, String 
phrase, AccountDetails accDetails) throws ApiException, RemoteException, 
OAuthException {

        ClientAccounts keyCol = new ClientAccounts();

        GleServices gleServices = new GleServices();

        TargetingIdea[] targetingIdea = null;

        GoogleTokenResponse tokenResp = new GoogleTokenResponse();

        tokenResp.setAccessToken(accDetails.getAccessToken());

        tokenResp.setRefreshToken(accDetails.getRefreshToken());

        gleServices.setAccountDetails(accDetails);

        TargetingIdeaPage page = new TargetingIdeaPage();

        try {

            adWordsSession = gleServices.createAdWordsSession(clientId, 
clientSecret, tokenResp.getRefreshToken(), developerToken, userAgent);

        } catch (ValidationException ex) {

            
Logger.getLogger(TenMinCampaignService.class.getName()).log(Level.SEVERE, 
null, ex);

        }

        TargetingIdeaServiceInterface targetingIdeaService = 
(TargetingIdeaServiceInterface) 
gleServices.getService(gleServices.TARGETING_IDEA_SERVICE, adWordsSession);


        TargetingIdeaSelector selector = new TargetingIdeaSelector();

        try {


            selector.setRequestType(RequestType.IDEAS);

            selector.setIdeaType(IdeaType.KEYWORD);

            selector.setRequestedAttributeTypes(new 
AttributeType[]{AttributeType.KEYWORD_TEXT});

            selector.setPaging(new Paging(0, 200));


            Location loc = new Location();

            loc.setId(2356L);

            LocationSearchParameter countryTargetSearchParameter = new 
LocationSearchParameter();

            countryTargetSearchParameter.setLocations(new Location[]{loc});


            Language lang = new Language();

            lang.setId(1000L);

            LanguageSearchParameter langTargetSearchParameter = new 
LanguageSearchParameter();

            langTargetSearchParameter.setLanguages(new Language[]{lang});


            List<SearchParameter> searchParameters = new ArrayList<>();

            RelatedToQuerySearchParameter relatedToQuerySearchParameter

                    = new RelatedToQuerySearchParameter();

            relatedToQuerySearchParameter.setQueries(new String[]{"bakery", 
"pastries", "birthday cake"});

            searchParameters.add(relatedToQuerySearchParameter);


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


            page = targetingIdeaService.get(selector);

            targetingIdea = page.getEntries();


        } catch (ApiException e) {

            for (ApiError er : e.getErrors()) {

                if (er instanceof RateExceededError) {

                    try {

                        Thread.sleep(((RateExceededError) 
er).getRetryAfterSeconds());    // 30seconds

                        page = targetingIdeaService.get(selector);

                        targetingIdea = page.getEntries();

                    } catch (Exception th) {

                        e.printStackTrace();

                        throw e;

                    }

                }

            }

            e.printStackTrace();

        }

        return targetingIdea;

    }

}


Please help me with this.

-- 




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.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
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/263c9e4f-6113-4a41-a48d-b50a937ce22c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to