Search in sources :

Example 1 with ManagedCustomerReturnValue

use of com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerReturnValue in project googleads-java-lib by googleads.

the class CreateAccount method runExample.

/**
 * Runs the example.
 *
 * @param adWordsServices the services factory.
 * @param session the session.
 * @throws ApiException if the API request failed with one or more service errors.
 * @throws RemoteException if the API request failed due to other errors.
 */
public static void runExample(AdWordsServicesInterface adWordsServices, AdWordsSession session) throws RemoteException {
    // Get the CampaignService.
    ManagedCustomerServiceInterface managedCustomerService = adWordsServices.get(session, ManagedCustomerServiceInterface.class);
    // Create account.
    ManagedCustomer customer = new ManagedCustomer();
    customer.setName("Customer created with ManagedCustomerService on " + DateTime.now());
    customer.setCurrencyCode("EUR");
    customer.setDateTimeZone("Europe/London");
    // Create operations.
    ManagedCustomerOperation operation = new ManagedCustomerOperation();
    operation.setOperand(customer);
    operation.setOperator(Operator.ADD);
    ManagedCustomerOperation[] operations = new ManagedCustomerOperation[] { operation };
    // Add account.
    ManagedCustomerReturnValue result = managedCustomerService.mutate(operations);
    // Display accounts.
    for (ManagedCustomer customerResult : result.getValue()) {
        System.out.printf("Account with customer ID %d was created.%n", customerResult.getCustomerId());
    }
}
Also used : ManagedCustomerReturnValue(com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerReturnValue) ManagedCustomer(com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomer) ManagedCustomerOperation(com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerOperation) ManagedCustomerServiceInterface(com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerServiceInterface)

Aggregations

ManagedCustomer (com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomer)1 ManagedCustomerOperation (com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerOperation)1 ManagedCustomerReturnValue (com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerReturnValue)1 ManagedCustomerServiceInterface (com.google.api.ads.adwords.axis.v201809.mcm.ManagedCustomerServiceInterface)1