use of com.google.api.ads.adwords.axis.v201809.cm.CampaignGroupServiceInterface in project googleads-java-lib by googleads.
the class AddCampaignGroupsAndPerformanceTargets method createCampaignGroup.
/**
* Creates a campaign group.
*/
private static CampaignGroup createCampaignGroup(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
// Get the CampaignGroupService.
CampaignGroupServiceInterface campaignGroupService = adWordsServices.get(session, CampaignGroupServiceInterface.class);
// Create the campaign group.
CampaignGroup campaignGroup = new CampaignGroup();
campaignGroup.setName("Mars campaign group #" + System.currentTimeMillis());
// Create the operation.
CampaignGroupOperation operation = new CampaignGroupOperation();
operation.setOperand(campaignGroup);
operation.setOperator(Operator.ADD);
CampaignGroup newCampaignGroup = campaignGroupService.mutate(new CampaignGroupOperation[] { operation }).getValue(0);
System.out.printf("Campaign group with ID %d and name '%s' was created.%n", newCampaignGroup.getId(), newCampaignGroup.getName());
return newCampaignGroup;
}
Aggregations