*
* @return the ID of the created campaign
*/
public long createCampaign() throws Exception {
// Get CampaignService
CampaignServiceInterface campaignService =
user.getService(AdWordsService.V201008.CAMPAIGN_SERVICE);
// Create campaign.
Campaign campaign = new Campaign();
campaign.setName("Test Campaign #" + System.currentTimeMillis());
campaign.setBiddingStrategy(new ManualCPC());
campaign.setStatus(CampaignStatus.PAUSED);
// Create budget
Budget budget = new Budget();
budget.setPeriod(BudgetBudgetPeriod.DAILY);
budget.setAmount(new Money(null, 50000000L));
budget.setDeliveryMethod(BudgetBudgetDeliveryMethod.STANDARD);
campaign.setBudget(budget);
// Create operations.
CampaignOperation operation = new CampaignOperation();
operation.setOperand(campaign);
operation.setOperator(Operator.ADD);
CampaignOperation[] operations = new CampaignOperation[] {operation};
// Add campaign and return campaign ID
return campaignService.mutate(operations).getValue()[0].getId();
}