runExample(adWordsServices, session);
}
public static BudgetSuggestion runExample(AdWordsServices adWordsServices, AdWordsSession session)
throws Exception {
BudgetSuggestionServiceInterface service =
adWordsServices.get(session, BudgetSuggestionServiceInterface.class);
BudgetSuggestionSelector selector = new BudgetSuggestionSelector();
List<Criterion> criteria = Lists.newArrayList();
// Criterion - Travel Agency product/service. See GetProductServices.java for an example
// of how to get valid product/service settings.
ProductService productService = new ProductService();
productService.setText("Travel Agency");
productService.setLocale("en_US");
criteria.add(productService);
// Criterion - English language.
// The ID can be found in the documentation:
// https://developers.google.com/adwords/api/docs/appendix/languagecodes
Language language = new Language();
language.setId(1000L);
criteria.add(language);
// Criterion - Mountain View, California location.
// The ID can be found in the documentation:
// https://developers.google.com/adwords/api/docs/appendix/geotargeting
// https://developers.google.com/adwords/api/docs/appendix/cities-DMAregions
Location location = new Location();
location.setId(1014044L);
criteria.add(location);
selector.setCriteria(criteria.toArray(new Criterion[criteria.size()]));
BudgetSuggestion budgetSuggestion = service.get(selector);
System.out.printf("Budget suggestion for criteria is:%n"
+ "\tSuggestedBudget=%s%n"
+ "\tMin/MaxBudget=%s/%s%n"
+ "\tMin/MaxCpc=%s/%s%n"