Issue getting a TargetingIdeaService instance in v201802

138 views
Skip to first unread message

hari....@1520holdings.com

unread,
Mar 19, 2018, 5:02:43 AM3/19/18
to AdWords API Forum
We've just migrated our AdWords API version from v201710 to v201802, and for some reason, our AdWordsService is no longer able to get a TargetingIdeaService instance. I don't think it has anything to do with our AdWords account because we are able to successfully use the exact same code below if we roll back the API version to v201710. Has anyone else encountered a problem with this?

Code Snippet:

        TargetingIdeaServiceInterface targetingIdeaService = adWordsServices.get(session, TargetingIdeaServiceInterface.class);

        // Create selector
        TargetingIdeaSelector selector = new TargetingIdeaSelector();
        selector.setRequestType(RequestType.STATS);
        selector.setIdeaType(IdeaType.KEYWORD);
        selector.setRequestedAttributeTypes(new AttributeType[] {
            AttributeType.KEYWORD_TEXT,
            AttributeType.SEARCH_VOLUME});

        // Set selector paging (required for targeting idea service).
        Paging paging = new Paging();
        paging.setStartIndex(0);
        paging.setNumberResults(1000);
        selector.setPaging(paging);

        // Create related to query search parameter.
        RelatedToQuerySearchParameter relatedToQuerySearchParameter = new RelatedToQuerySearchParameter();
        relatedToQuerySearchParameter.setQueries(keywords);

        // Location setting
        LocationSearchParameter locationParameter = new LocationSearchParameter();
        Location local = new Location();
        local.setId(locationMetric);
        
        LanguageSearchParameter languageParameter = new LanguageSearchParameter();
        Language english = new Language();
        english.setId(1000L);
        languageParameter.setLanguages(new Language[] {english});

        // Create network search parameter (optional).
        NetworkSetting networkSetting = new NetworkSetting();
        networkSetting.setTargetGoogleSearch(true);
        networkSetting.setTargetSearchNetwork(false);
        networkSetting.setTargetContentNetwork(false);
        networkSetting.setTargetPartnerSearchNetwork(false);

        NetworkSearchParameter networkSearchParameter = new NetworkSearchParameter();
        networkSearchParameter.setNetworkSetting(networkSetting);

        try{
            
            // Get local search volumes
            locationParameter.setLocations(new Location[] {local});

            selector.setSearchParameters(
                new SearchParameter[] {relatedToQuerySearchParameter, locationParameter, languageParameter,
                    networkSearchParameter});
            TargetingIdeaPage page = targetingIdeaService.get(selector);
    .
    .
    .
}
catch(Exception ex){
    .
    .
    .
}

Whenever I run this code snippet, I get the following error pointing to the line highlighted in red above:

java.lang.NullPointerException: No group found for service: v201802.TargetingIdeaService
at com.google.api.ads.adwords.lib.conf.AdWordsApiConfiguration.getServiceUrlGroup(AdWordsApiConfiguration.java:52)
at com.google.api.ads.adwords.lib.client.AdWordsServiceDescriptor.getEndpointAddress(AdWordsServiceDescriptor.java:77)
at com.google.api.ads.common.lib.factory.helper.BaseAdsServiceClientFactoryHelper.createAdsServiceClient(BaseAdsServiceClientFactoryHelper.java:73)
at com.google.api.ads.common.lib.factory.AdsServiceClientFactory.getServiceClient(AdsServiceClientFactory.java:76)
at com.google.api.ads.common.lib.factory.BaseAdsServiceClientFactory.getServiceClientAsInterface(BaseAdsServiceClientFactory.java:81)
at com.google.api.ads.common.lib.factory.BaseServices.get(BaseServices.java:45)

Has anyone else run into this problem with the latest API version?

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Mar 19, 2018, 12:32:24 PM3/19/18
to AdWords API Forum
Hi Hari, 

I was able to upgrade to the V201802 version of the API using the Java client library and use the TargetingIdeaService without any issues. Could you please confirm if you are using the latest version (googleads-java-lib-v3.12.0) of the Java client library? Also, how did you update to the latest version? From the error message, it looks like the library upgrade was not successful. You could either use the Jars with examples or maven with examples from the client library github. Are you able to make API calls to other API services without issues? 

Thanks,
Sreelakshmi, AdWords API Team

hari....@1520holdings.com

unread,
Mar 21, 2018, 6:26:20 AM3/21/18
to AdWords API Forum
Hi Sreelakshmi, thank you for responding so promptly. I was actually manually removing the old Jars and adding the new ones in my IDE, and it looks like I mistakenly left one of the old dependencies in there. I deleted all of the Jars from my project library and added back the ones for the new version, and I'm able to get a TargetingIdeaService instance now. Definitely was flummoxed by the error I got; thanks for catching that mistake! 

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Mar 21, 2018, 12:59:07 PM3/21/18
to AdWords API Forum
Hi Hari, 

Glad that you were able to fix the issue.
Reply all
Reply to author
Forward
0 new messages