Examples of PromotionServiceInterface


Examples of com.google.api.ads.adwords.axis.v201402.express.PromotionServiceInterface

      Long businessId) throws Exception {

    session.setExpressBusinessId(businessId);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    int offset = 0;

    Selector selector = new SelectorBuilder()
        .fields("PromotionId",
            "Name",
            "Status",
            "DestinationUrl",
            "StreetAddressVisible",
            "CallTrackingEnabled",
            "ContentNetworkOptedOut",
            "Budget",
            "PromotionCriteria",
            "RemainingBudget",
            "Creatives",
            "CampaignIds")
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

    List<Promotion> promotions = Lists.newArrayList();
    PromotionPage page;
    do {
      // Get all promotions for the business
      page = promotionService.get(selector);

      // Display promotions
      if (page.getTotalNumEntries() > 0) {
        for (Promotion promotion : page.getEntries()) {
          System.out.printf("Express promotion found with ID %d and name '%s'%n", promotion.getId(),
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.express.PromotionServiceInterface

  }

  public static Promotion runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long businessId, Long promotionId) throws Exception {
    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    // PromotionService requires an Express business ID
    session.setExpressBusinessId(businessId);

    // Update the budget for the promotion
    Promotion promotion = new Promotion();
    promotion.setId(promotionId);
    Money newBudget = new Money();
    newBudget.setMicroAmount(2000000L);
    promotion.setBudget(newBudget);

    Promotion[] mutatedPromotions = promotionService.mutate(
        new PromotionOperation[] {new PromotionOperation(Operator.SET, null, promotion)});

    System.out.printf("Promotion ID %d for business ID %d now has budget micro amount %,d%n",
        promotionId, businessId, mutatedPromotions[0].getBudget().getMicroAmount());
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.express.PromotionServiceInterface

        .build();

    ExpressBusiness business = businessService.get(businessSelector).getEntries(0);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    // PromotionService requires the businessId on the session
    session.setExpressBusinessId(businessId);

    // Set up the new Promotion
    Promotion marsTourPromotion = new Promotion();
    Money budget = new Money();
    budget.setMicroAmount(1000000L);
    marsTourPromotion.setName("Mars Tour Promotion " + System.currentTimeMillis());
    marsTourPromotion.setStatus(PromotionStatus.PAUSED);
    marsTourPromotion.setDestinationUrl("http://www.example.com");
    marsTourPromotion.setBudget(budget);
    marsTourPromotion.setCallTrackingEnabled(true);

    // Criteria
    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 - Within 15 miles
    Proximity proximity = new Proximity();
    proximity.setGeoPoint(business.getGeoPoint());
    proximity.setRadiusDistanceUnits(ProximityDistanceUnits.MILES);
    proximity.setRadiusInUnits(15d);
    criteria.add(proximity);

    marsTourPromotion.setCriteria(criteria.toArray(new Criterion[criteria.size()]));

    // Creatives
    List<Creative> creatives = Lists.newArrayList();
    Creative creative1 =
        new Creative("Standard Mars Trip", "Fly coach to Mars", "Free in-flight pretzels");
    creatives.add(creative1);

    Creative creative2 = new Creative("Deluxe Mars Trip", "Fly first class to Mars",
        "Unlimited powdered orange drink");
    creatives.add(creative2);

    marsTourPromotion.setCreatives(creatives.toArray(new Creative[creatives.size()]));

    Promotion[] addedPromotions = promotionService.mutate(
        new PromotionOperation[] {new PromotionOperation(Operator.ADD, null, marsTourPromotion)});

    System.out.printf("Added promotion ID %d with name '%s' to business ID %d%n",
        addedPromotions[0].getId(), addedPromotions[0].getName(), businessId);
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.express.PromotionServiceInterface

      Long businessId) throws Exception {

    session.setExpressBusinessId(businessId);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    int offset = 0;

    Selector selector = new SelectorBuilder()
        .fields("PromotionId",
            "Name",
            "Status",
            "DestinationUrl",
            "StreetAddressVisible",
            "CallTrackingEnabled",
            "ContentNetworkOptedOut",
            "Budget",
            "PromotionCriteria",
            "RemainingBudget",
            "Creatives",
            "CampaignIds")
        .offset(offset)
        .limit(PAGE_SIZE)
        .build();

    List<Promotion> promotions = Lists.newArrayList();
    PromotionPage page;
    do {
      // Get all promotions for the business
      page = promotionService.get(selector);

      // Display promotions
      if (page.getTotalNumEntries() > 0) {
        for (Promotion promotion : page.getEntries()) {
          System.out.printf("Express promotion found with ID %d and name '%s'%n", promotion.getId(),
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.express.PromotionServiceInterface

  }

  public static Promotion runExample(AdWordsServices adWordsServices, AdWordsSession session,
      Long businessId, Long promotionId) throws Exception {
    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    // PromotionService requires an Express business ID
    session.setExpressBusinessId(businessId);

    // Update the budget for the promotion
    Promotion promotion = new Promotion();
    promotion.setId(promotionId);
    Money newBudget = new Money();
    newBudget.setMicroAmount(2000000L);
    promotion.setBudget(newBudget);

    Promotion[] mutatedPromotions = promotionService.mutate(
        new PromotionOperation[] {new PromotionOperation(Operator.SET, null, promotion)});

    System.out.printf("Promotion ID %d for business ID %d now has budget micro amount %,d%n",
        promotionId, businessId, mutatedPromotions[0].getBudget().getMicroAmount());
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.express.PromotionServiceInterface

        .build();

    ExpressBusiness business = businessService.get(businessSelector).getEntries(0);

    // Get the PromotionService
    PromotionServiceInterface promotionService =
        adWordsServices.get(session, PromotionServiceInterface.class);

    // PromotionService requires the businessId on the session
    session.setExpressBusinessId(businessId);

    // Set up the new Promotion
    Promotion marsTourPromotion = new Promotion();
    Money budget = new Money();
    budget.setMicroAmount(1000000L);
    marsTourPromotion.setName("Mars Tour Promotion " + System.currentTimeMillis());
    marsTourPromotion.setStatus(PromotionStatus.PAUSED);
    marsTourPromotion.setDestinationUrl("http://www.example.com");
    marsTourPromotion.setBudget(budget);
    marsTourPromotion.setCallTrackingEnabled(true);

    // Criteria
    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 - Within 15 miles
    Proximity proximity = new Proximity();
    proximity.setGeoPoint(business.getGeoPoint());
    proximity.setRadiusDistanceUnits(ProximityDistanceUnits.MILES);
    proximity.setRadiusInUnits(15d);
    criteria.add(proximity);

    marsTourPromotion.setCriteria(criteria.toArray(new Criterion[criteria.size()]));

    // Creatives
    List<Creative> creatives = Lists.newArrayList();
    Creative creative1 =
        new Creative("Standard Mars Trip", "Fly coach to Mars", "Free in-flight pretzels");
    creatives.add(creative1);

    Creative creative2 = new Creative("Deluxe Mars Trip", "Fly first class to Mars",
        "Unlimited powdered orange drink");
    creatives.add(creative2);

    marsTourPromotion.setCreatives(creatives.toArray(new Creative[creatives.size()]));

    Promotion[] addedPromotions = promotionService.mutate(
        new PromotionOperation[] {new PromotionOperation(Operator.ADD, null, marsTourPromotion)});

    System.out.printf("Added promotion ID %d with name '%s' to business ID %d%n",
        addedPromotions[0].getId(), addedPromotions[0].getName(), businessId);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.