Re: Getting Null response for some keywords requests

2014-12-03 Thread Jorge Brasil
Hi Josh,

My issue is that some parameters of the keywords estimations are coming as 
null. So I make the request with success but some in some responses a few 
parameters are null, for example cpc max = nulll  cpc min = null.
If I try the same keyword with the same value in python for example instead 
of null I get zero.
I can build exception on my script but do you have any idea why this is 
happening?

Best 

On Tuesday, 2 December 2014 15:53:11 UTC, Jorge Brasil wrote:

 Hi,

 I am developing an application that uses the traffic estimation service to 
 get some predictions for the keywords traffic for my company adds.

 The issue is that for some keywords that are in one of our campaigns I get 
 a null response from the API, also if I make multiple calls for the same 
 keyword ate some point the response is going to be null.


 here is my code


 // Copyright 2014 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 // http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an AS IS BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.

 package adwords.axis.v201409.optimization;

 import com.google.api.ads.adwords.axis.factory.AdWordsServices;
 import com.google.api.ads.adwords.axis.v201409.cm.Criterion;
 import com.google.api.ads.adwords.axis.v201409.cm.Keyword;
 import com.google.api.ads.adwords.axis.v201409.cm.KeywordMatchType;
 import com.google.api.ads.adwords.axis.v201409.cm.Language;
 import com.google.api.ads.adwords.axis.v201409.cm.Location;
 import com.google.api.ads.adwords.axis.v201409.cm.Money;
 import com.google.api.ads.adwords.axis.v201409.o.AdGroupEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.CampaignEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimate;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorResult;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorSelector;
 import 
 com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorServiceInterface;
 import com.google.api.ads.adwords.lib.client.AdWordsSession;
 import com.google.api.ads.common.lib.auth.OfflineCredentials;
 import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
 import com.google.api.client.auth.oauth2.Credential;

 import java.util.ArrayList;
 import java.util.List;

 /**
  * This example gets keyword traffic estimates.
  *
  * Credentials and properties in {@code fromFile()} are pulled from the
  * ads.properties file. See README for more info.
  *
  * Tags: TrafficEstimatorService.get
  *
  * Category: adx-exclude
  *
  * @author Kevin Winter
  */
 public class EstimateKeywordTraffic {
 public static ArrayList parameters = new ArrayList();
 public static ArrayList words_param = new ArrayList();
 public static ArrayList bid_values = new ArrayList();
 public static ArrayList copy_bid = new ArrayList();
 private static  ListMoney bids = new ArrayListMoney();
   
 /*
 public static void main(String[] args) throws Exception {
 // Generate a refreshable OAuth2 credential similar to a ClientLogin 
 token
 // and can be used in place of a service account.
 Credential oAuth2Credential = new OfflineCredentials.Builder()
 .forApi(Api.ADWORDS)
 .fromFile()
 .build()
 .generateCredential();

 // Construct an AdWordsSession.
 AdWordsSession session = new AdWordsSession.Builder()
 .fromFile()
 .withOAuth2Credential(oAuth2Credential)
 .build();

 AdWordsServices adWordsServices = new AdWordsServices();

 runExample(adWordsServices, session);
   }
 */
   public static void runExample(

 AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
 // Get the TrafficEstimatorService.
  
   
   TrafficEstimatorServiceInterface trafficEstimatorService =
 adWordsServices.get(session, 
 TrafficEstimatorServiceInterface.class);

 // Create keywords. Refer to the TrafficEstimatorService documentation 
 for the maximum
 // number of keywords that can be passed in a single request.
 //   
 https://developers.google.com/adwords/api/docs/reference/latest/TrafficEstimatorService
 ListKeyword keywords = new ArrayListKeyword();
   
 keywords.add(new Keyword(null, null, null, public liability 
 insurance, KeywordMatchType.PHRASE));
//keywords.add(new Keyword(null, null, null, Insurance public, 
 KeywordMatchType.EXACT));
//keywords.add(new Keyword(null, null, null, insurance liability, 
 KeywordMatchType.EXACT));

Re: Getting Null response for some keywords requests

2014-12-03 Thread Josh Radcliff (AdWords API Team)
Hi Jorge,

The keywords that are returning null for those values probably do not have 
enough search volume for AdWords to produce meaningful statistics. Starting 
in v201406 (see the release notes 
https://developers.google.com/adwords/api/docs/reference/#v201406):

Changes to displayed values
   
   - TrafficEstimatorService will no longer return a 0 for a derived field 
   if its denominator is zero; it will omit the field entirely.

Therefore, your code should handle nulls gracefully. I'll make a note of 
this so we update our code example accordingly.

Cheers,
Josh, AdWords API Team

On Wednesday, December 3, 2014 6:07:18 AM UTC-5, Jorge Brasil wrote:

 Hi Josh,

 My issue is that some parameters of the keywords estimations are coming as 
 null. So I make the request with success but some in some responses a few 
 parameters are null, for example cpc max = nulll  cpc min = null.
 If I try the same keyword with the same value in python for example 
 instead of null I get zero.
 I can build exception on my script but do you have any idea why this is 
 happening?

 Best 

 On Tuesday, 2 December 2014 15:53:11 UTC, Jorge Brasil wrote:

 Hi,

 I am developing an application that uses the traffic estimation service 
 to get some predictions for the keywords traffic for my company adds.

 The issue is that for some keywords that are in one of our campaigns I 
 get a null response from the API, also if I make multiple calls for the 
 same keyword ate some point the response is going to be null.


 here is my code


 // Copyright 2014 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 // http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an AS IS BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
 implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.

 package adwords.axis.v201409.optimization;

 import com.google.api.ads.adwords.axis.factory.AdWordsServices;
 import com.google.api.ads.adwords.axis.v201409.cm.Criterion;
 import com.google.api.ads.adwords.axis.v201409.cm.Keyword;
 import com.google.api.ads.adwords.axis.v201409.cm.KeywordMatchType;
 import com.google.api.ads.adwords.axis.v201409.cm.Language;
 import com.google.api.ads.adwords.axis.v201409.cm.Location;
 import com.google.api.ads.adwords.axis.v201409.cm.Money;
 import com.google.api.ads.adwords.axis.v201409.o.AdGroupEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.CampaignEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimate;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorResult;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorSelector;
 import 
 com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorServiceInterface;
 import com.google.api.ads.adwords.lib.client.AdWordsSession;
 import com.google.api.ads.common.lib.auth.OfflineCredentials;
 import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
 import com.google.api.client.auth.oauth2.Credential;

 import java.util.ArrayList;
 import java.util.List;

 /**
  * This example gets keyword traffic estimates.
  *
  * Credentials and properties in {@code fromFile()} are pulled from the
  * ads.properties file. See README for more info.
  *
  * Tags: TrafficEstimatorService.get
  *
  * Category: adx-exclude
  *
  * @author Kevin Winter
  */
 public class EstimateKeywordTraffic {
 public static ArrayList parameters = new ArrayList();
 public static ArrayList words_param = new ArrayList();
 public static ArrayList bid_values = new ArrayList();
 public static ArrayList copy_bid = new ArrayList();
 private static  ListMoney bids = new ArrayListMoney();
   
 /*
 public static void main(String[] args) throws Exception {
 // Generate a refreshable OAuth2 credential similar to a ClientLogin 
 token
 // and can be used in place of a service account.
 Credential oAuth2Credential = new OfflineCredentials.Builder()
 .forApi(Api.ADWORDS)
 .fromFile()
 .build()
 .generateCredential();

 // Construct an AdWordsSession.
 AdWordsSession session = new AdWordsSession.Builder()
 .fromFile()
 .withOAuth2Credential(oAuth2Credential)
 .build();

 AdWordsServices adWordsServices = new AdWordsServices();

 runExample(adWordsServices, session);
   }
 */
   public static void runExample(

 AdWordsServices adWordsServices, AdWordsSession session) throws Exception 
 {
 // Get the TrafficEstimatorService.
  
   
   TrafficEstimatorServiceInterface trafficEstimatorService =
 

Getting Null response for some keywords requests

2014-12-02 Thread Jorge Brasil
Hi,

I am developing an application that uses the traffic estimation service to 
get some predictions for the keywords traffic for my company adds.

The issue is that for some keywords that are in one of our campaigns I get 
a null response from the API, also if I make multiple calls for the same 
keyword ate some point the response is going to be null.


here is my code


// Copyright 2014 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an AS IS BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package adwords.axis.v201409.optimization;

import com.google.api.ads.adwords.axis.factory.AdWordsServices;
import com.google.api.ads.adwords.axis.v201409.cm.Criterion;
import com.google.api.ads.adwords.axis.v201409.cm.Keyword;
import com.google.api.ads.adwords.axis.v201409.cm.KeywordMatchType;
import com.google.api.ads.adwords.axis.v201409.cm.Language;
import com.google.api.ads.adwords.axis.v201409.cm.Location;
import com.google.api.ads.adwords.axis.v201409.cm.Money;
import com.google.api.ads.adwords.axis.v201409.o.AdGroupEstimateRequest;
import com.google.api.ads.adwords.axis.v201409.o.CampaignEstimateRequest;
import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimate;
import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimateRequest;
import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorResult;
import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorSelector;
import 
com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorServiceInterface;
import com.google.api.ads.adwords.lib.client.AdWordsSession;
import com.google.api.ads.common.lib.auth.OfflineCredentials;
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
import com.google.api.client.auth.oauth2.Credential;

import java.util.ArrayList;
import java.util.List;

/**
 * This example gets keyword traffic estimates.
 *
 * Credentials and properties in {@code fromFile()} are pulled from the
 * ads.properties file. See README for more info.
 *
 * Tags: TrafficEstimatorService.get
 *
 * Category: adx-exclude
 *
 * @author Kevin Winter
 */
public class EstimateKeywordTraffic {
public static ArrayList parameters = new ArrayList();
public static ArrayList words_param = new ArrayList();
public static ArrayList bid_values = new ArrayList();
public static ArrayList copy_bid = new ArrayList();
private static  ListMoney bids = new ArrayListMoney();
  
/*
public static void main(String[] args) throws Exception {
// Generate a refreshable OAuth2 credential similar to a ClientLogin 
token
// and can be used in place of a service account.
Credential oAuth2Credential = new OfflineCredentials.Builder()
.forApi(Api.ADWORDS)
.fromFile()
.build()
.generateCredential();

// Construct an AdWordsSession.
AdWordsSession session = new AdWordsSession.Builder()
.fromFile()
.withOAuth2Credential(oAuth2Credential)
.build();

AdWordsServices adWordsServices = new AdWordsServices();

runExample(adWordsServices, session);
  }
*/
  public static void runExample(
   
AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
// Get the TrafficEstimatorService.
 
  
  TrafficEstimatorServiceInterface trafficEstimatorService =
adWordsServices.get(session, 
TrafficEstimatorServiceInterface.class);

// Create keywords. Refer to the TrafficEstimatorService documentation 
for the maximum
// number of keywords that can be passed in a single request.
//   
https://developers.google.com/adwords/api/docs/reference/latest/TrafficEstimatorService
ListKeyword keywords = new ArrayListKeyword();
  
keywords.add(new Keyword(null, null, null, public liability 
insurance, KeywordMatchType.PHRASE));
   //keywords.add(new Keyword(null, null, null, Insurance public, 
KeywordMatchType.EXACT));
   //keywords.add(new Keyword(null, null, null, insurance liability, 
KeywordMatchType.EXACT));
   keywords.add(new Keyword(null, null, null, liability insurance, 
KeywordMatchType.BROAD));

int number_of_keywords = keywords.size();

bids.clear();
bid_values.clear();
words_param.clear();
parameters.clear();
bid_values =  utilities.Bids(number_of_keywords);
   
for(int i = 0 ; i bid_values.size(); i++ )
{
 
 Double aux = (Double)bid_values.get(i)*10;
 bids.add(new Money(null, aux.longValue()));
}


// Create a keyword estimate request for each keyword.
ListKeywordEstimateRequest keywordEstimateRequests = new 

Re: Getting Null response for some keywords requests

2014-12-02 Thread Josh Radcliff (AdWords API Team)
Hi Jorge,

From your other post 
https://groups.google.com/d/msg/adwords-api/XMjKcLk_Ck4/4KkbLXHb2QsJ I 
thought you had resolved this issue. Also, when you say you get a null 
response, do you mean you get a SOAP fault back?

Thanks,
Josh, AdWords API Team

On Tuesday, December 2, 2014 10:53:11 AM UTC-5, Jorge Brasil wrote:

 Hi,

 I am developing an application that uses the traffic estimation service to 
 get some predictions for the keywords traffic for my company adds.

 The issue is that for some keywords that are in one of our campaigns I get 
 a null response from the API, also if I make multiple calls for the same 
 keyword ate some point the response is going to be null.


 here is my code


 // Copyright 2014 Google Inc. All Rights Reserved.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
 // http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an AS IS BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.

 package adwords.axis.v201409.optimization;

 import com.google.api.ads.adwords.axis.factory.AdWordsServices;
 import com.google.api.ads.adwords.axis.v201409.cm.Criterion;
 import com.google.api.ads.adwords.axis.v201409.cm.Keyword;
 import com.google.api.ads.adwords.axis.v201409.cm.KeywordMatchType;
 import com.google.api.ads.adwords.axis.v201409.cm.Language;
 import com.google.api.ads.adwords.axis.v201409.cm.Location;
 import com.google.api.ads.adwords.axis.v201409.cm.Money;
 import com.google.api.ads.adwords.axis.v201409.o.AdGroupEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.CampaignEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimate;
 import com.google.api.ads.adwords.axis.v201409.o.KeywordEstimateRequest;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorResult;
 import com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorSelector;
 import 
 com.google.api.ads.adwords.axis.v201409.o.TrafficEstimatorServiceInterface;
 import com.google.api.ads.adwords.lib.client.AdWordsSession;
 import com.google.api.ads.common.lib.auth.OfflineCredentials;
 import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
 import com.google.api.client.auth.oauth2.Credential;

 import java.util.ArrayList;
 import java.util.List;

 /**
  * This example gets keyword traffic estimates.
  *
  * Credentials and properties in {@code fromFile()} are pulled from the
  * ads.properties file. See README for more info.
  *
  * Tags: TrafficEstimatorService.get
  *
  * Category: adx-exclude
  *
  * @author Kevin Winter
  */
 public class EstimateKeywordTraffic {
 public static ArrayList parameters = new ArrayList();
 public static ArrayList words_param = new ArrayList();
 public static ArrayList bid_values = new ArrayList();
 public static ArrayList copy_bid = new ArrayList();
 private static  ListMoney bids = new ArrayListMoney();
   
 /*
 public static void main(String[] args) throws Exception {
 // Generate a refreshable OAuth2 credential similar to a ClientLogin 
 token
 // and can be used in place of a service account.
 Credential oAuth2Credential = new OfflineCredentials.Builder()
 .forApi(Api.ADWORDS)
 .fromFile()
 .build()
 .generateCredential();

 // Construct an AdWordsSession.
 AdWordsSession session = new AdWordsSession.Builder()
 .fromFile()
 .withOAuth2Credential(oAuth2Credential)
 .build();

 AdWordsServices adWordsServices = new AdWordsServices();

 runExample(adWordsServices, session);
   }
 */
   public static void runExample(

 AdWordsServices adWordsServices, AdWordsSession session) throws Exception {
 // Get the TrafficEstimatorService.
  
   
   TrafficEstimatorServiceInterface trafficEstimatorService =
 adWordsServices.get(session, 
 TrafficEstimatorServiceInterface.class);

 // Create keywords. Refer to the TrafficEstimatorService documentation 
 for the maximum
 // number of keywords that can be passed in a single request.
 //   
 https://developers.google.com/adwords/api/docs/reference/latest/TrafficEstimatorService
 ListKeyword keywords = new ArrayListKeyword();
   
 keywords.add(new Keyword(null, null, null, public liability 
 insurance, KeywordMatchType.PHRASE));
//keywords.add(new Keyword(null, null, null, Insurance public, 
 KeywordMatchType.EXACT));
//keywords.add(new Keyword(null, null, null, insurance liability, 
 KeywordMatchType.EXACT));
keywords.add(new Keyword(null, null, null, liability insurance, 
 KeywordMatchType.BROAD));

 int number_of_keywords = keywords.size();