Package com.google.api.ads.dfp.v201208

Examples of com.google.api.ads.dfp.v201208.Order


      // Create an array to store local label objects.
      Label[] labels = new Label[5];

      for (int i = 0; i < 5; i++) {
        Label label = new Label();
        label.setName("Label #" + i);
        label.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION});
        labels[i] = label;
      }

      // Create the labels on the server.
      labels = labelService.createLabels(labels);

      if (labels != null) {
        for (Label label : labels) {
          List<String> labelTypes = new ArrayList<String>();
          for (LabelType labelType : label.getTypes()) {
            labelTypes.add(labelType.toString());
          }
          System.out.println("A label with ID \"" + label.getId()
              + "\", name \"" + label.getName()
              + "\", and types {" + StringUtils.join(labelTypes, ",") + "} was created.");
        }
      } else {
        System.out.println("No labels created.");
      }
View Full Code Here


      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the LabelService.
      LabelServiceInterface labelService = user.getService(DfpService.V201208.LABEL_SERVICE);

      // Create an array to store local label objects.
      Label[] labels = new Label[5];

      for (int i = 0; i < 5; i++) {
        Label label = new Label();
        label.setName("Label #" + i);
        label.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION});
        labels[i] = label;
      }

      // Create the labels on the server.
      labels = labelService.createLabels(labels);

      if (labels != null) {
        for (Label label : labels) {
          List<String> labelTypes = new ArrayList<String>();
          for (LabelType labelType : label.getTypes()) {
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("WHERE lineItemId = :lineItemId LIMIT 500")
              .putValue("lineItemId", lineItemId).toStatement();

      // Get LICAs by statement.
      LineItemCreativeAssociationPage page =
         licaService.getLineItemCreativeAssociationsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (LineItemCreativeAssociation lica : page.getResults()) {
          System.out.println(i + ") LICA with line item ID \"" + lica.getLineItemId()
              + "\", creative ID \"" + lica.getCreativeId()
              + "\", and status \"" + lica.getStatus()
              + "\" was found.");
          i++;
        }
      }

      System.out.println("Number of results found: " + page.getTotalResultSetSize());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

      // Get DfpUser from "~/dfp.properties".
      DfpUser user = new DfpUser();

      // Get the LineItemCreativeAssociationService.
      LineItemCreativeAssociationServiceInterface licaService =
          user.getService(DfpService.V201208.LINEITEMCREATIVEASSOCIATION_SERVICE);

      // Set the line item to get LICAs by.
      Long lineItemId = Long.parseLong("INSERT_LINE_ITEM_ID_HERE");

      // Create a statement to only select LICAs for the given lineItem ID.
      Statement filterStatement =
          new StatementBuilder("WHERE lineItemId = :lineItemId LIMIT 500")
              .putValue("lineItemId", lineItemId).toStatement();

      // Get LICAs by statement.
      LineItemCreativeAssociationPage page =
         licaService.getLineItemCreativeAssociationsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (LineItemCreativeAssociation lica : page.getResults()) {
          System.out.println(i + ") LICA with line item ID \"" + lica.getLineItemId()
View Full Code Here

      // Get the InventoryService.
      InventoryServiceInterface inventoryService =
          user.getService(DfpService.V201208.INVENTORY_SERVICE);

      // Get the NetworkService.
      NetworkServiceInterface networkService =
          user.getService(DfpService.V201208.NETWORK_SERVICE);

      // Get the effective root ad unit ID of the network.
      String effectiveRootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();

      // Create a statement to select the children of the effective root ad
      // unit.
      Statement filterStatement = new StatementBuilder("WHERE parentId = :id LIMIT 500")
          .putValue("id", effectiveRootAdUnitId).toStatement();
View Full Code Here

      // Get DfpUser from "~/dfp.properties". Comment out the networkCode field
      // to retrieve all networks you have access to.
      DfpUser user = new DfpUser();

      // Get the NetworkService.
      NetworkServiceInterface networkService = user.getService(DfpService.V201208.NETWORK_SERVICE);

      // Get all networks that you have access to with the current login
      // credentials.
      Network[] networks = networkService.getAllNetworks();

      int i = 0;
      for (Network network : networks) {
        System.out.println(i + ") Network with network code \"" + network.getNetworkCode()
            + "\" and display name \"" + network.getDisplayName() + "\" was found.");
View Full Code Here

      return new TextValue(null, null);
    } else {
      if (value instanceof Boolean) {
        return new BooleanValue(null, (Boolean) value);
      } else if (value instanceof Double) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof String) {
        return new TextValue(null, (String) value);
      } else if (value instanceof Long) {
        return new NumberValue(null, value.toString());
      } else if (value instanceof DateTime) {
        return new DateTimeValue(null, (DateTime) value);
      } else {
        throw new IllegalArgumentException("Unexpected Value type ["
            + value.getClass() + "]");
View Full Code Here

      // Set the ID of the order to get.
      Long orderId = Long.parseLong("INSERT_ORDER_ID_HERE");

      // Get the order.
      Order order = orderService.getOrder(orderId);

      if (order != null) {
        System.out.println("An order with ID \""
            + order.getId() + "\", name \"" + order.getName()
            + "\", and advertiser ID \"" + order.getAdvertiserId()
            + "\" was found.");
      } else {
        System.out.println("No order found for this ID.");
      }
    } catch (Exception e) {
View Full Code Here

      // Create an array to store local order objects.
      Order[] orders = new Order[5];

      for (int i = 0; i < 5; i++) {
        Order order = new Order();
        order.setName("Order #" + i);
        order.setAdvertiserId(advertiserId);
        order.setSalespersonId(salespersonId);
        order.setTraffickerId(traffickerId);

        orders[i] = order;
      }

      // Create the orders on the server.
      orders = orderService.createOrders(orders);

      if (orders != null) {
        for (Order order : orders) {
          System.out.println("An order with ID \""
              + order.getId() + "\" and named \"" + order.getName() + "\" was created.");
        }
      } else {
        System.out.println("No orders created.");
      }
    } catch (Exception e) {
View Full Code Here

    // Get the ReportService.
    ReportServiceInterface reportService = user.getService(DfpService.V201208.REPORT_SERVICE);

    // Create report job.
    ReportJob reportJob = new ReportJob();

    // Create report query.
    ReportQuery reportQuery = new ReportQuery();
    reportQuery.setDateRangeType(DateRangeType.CUSTOM_DATE);
    reportQuery.setStartDate(DateUtils.fromString("2011-03-01"));
    reportQuery.setEndDate(DateUtils.today("PST"));
    reportQuery.setDimensions(new Dimension[] {Dimension.ORDER, Dimension.LINE_ITEM});
    reportQuery.setColumns(new Column[] {Column.AD_SERVER_IMPRESSIONS,
        Column.AD_SERVER_CLICKS, Column.AD_SERVER_CTR,
        Column.AD_SERVER_CPM_AND_CPC_REVENUE, Column.AD_SERVER_AVERAGE_ECPM});
    reportJob.setReportQuery(reportQuery);

    System.out.println("Running report job.");

    // Run report job.
    long reportJobId = reportService.runReportJob(reportJob).getId();
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201208.Order

Copyright © 2018 www.massapicom. 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.