Package com.google.api.ads.dfp.v201302

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


      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

      // Set defaults for page and filterStatement.
      ContactPage page = new ContactPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all contacts.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get contacts by statement.
        page = contactService.getContactsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Contact contact : page.getResults()) {
            System.out.printf(
                "%s) Contact with ID \"%d\" and name \"%s\" was found.\n", i++,
                contact.getId(), contact.getName());
          }
        }

        offset += 500;
      } while (offset < page.getTotalResultSetSize());

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


      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ContactStatus.UNINVITED.toString()).toStatement();

      // Get contacts by statement.
      ContactPage page = contactService.getContactsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Contact contact : page.getResults()) {
          System.out.printf(
              "%s) Contact with ID \"%d\" and name \"%s\" was found.\n", i++,
              contact.getId(), contact.getName());
        }
      }

      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 ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

      // Set defaults for page and filterStatement.
      ContactPage page = new ContactPage();
      Statement filterStatement = new Statement();
      int offset = 0;

      do {
        // Create a statement to get all contacts.
        filterStatement.setQuery("LIMIT 500 OFFSET " + offset);

        // Get contacts by statement.
        page = contactService.getContactsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (Contact contact : page.getResults()) {
            System.out.printf(
View Full Code Here

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

      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201302.CONTACT_SERVICE);

      // Create a statement to only select contacts that aren't invited yet.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500")
              .putValue("status", ContactStatus.UNINVITED.toString()).toStatement();

      // Get contacts by statement.
      ContactPage page = contactService.getContactsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Contact contact : page.getResults()) {
          System.out.printf(
View Full Code Here

      // Set the ID of the creative to get.
      Long creativeId = Long.parseLong("INSERT_CREATIVE_ID_HERE");

      // Get the creative.
      Creative creative = creativeService.getCreative(creativeId);

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

          imageCreative.setAdvertiserId(imageCreative.getAdvertiserId());
          imageCreative.setName(
              imageCreative.getName() + " (Copy #" + System.currentTimeMillis() + ")");

          // Create image asset.
          CreativeAsset creativeAsset = new CreativeAsset();
          creativeAsset.setFileName("image.jpg");
          creativeAsset.setAssetByteArray(
              MediaUtils.getAssetDataFromUrl(imageCreative.getPrimaryImageAsset().getAssetUrl()));
          creativeAsset.setSize(imageCreative.getPrimaryImageAsset().getSize());
          imageCreative.setPrimaryImageAsset(creativeAsset);

          creatives[i] = imageCreative;
        }
View Full Code Here

        imageCreative.setAdvertiserId(advertiserId);
        imageCreative.setDestinationUrl("http://google.com");
        imageCreative.setSize(size);

        // Create image asset.
        CreativeAsset creativeAsset = new CreativeAsset();
        creativeAsset.setFileName("image.jpg");
        creativeAsset.setAssetByteArray(MediaUtils.getAssetDataFromUrl(
            "http://www.google.com/intl/en/adwords/select/images/samples/inline.jpg"));
        creativeAsset.setSize(size);
        imageCreative.setPrimaryImageAsset(creativeAsset);

        imageCreatives[i] = imageCreative;
      }
View Full Code Here

          new StatementBuilder("WHERE id IN ( " + StringUtils.join(imageCreativeIds, ',')
              + ") and creativeType = :creativeType LIMIT 500").putValue("creativeType",
              ImageCreative.class.getSimpleName());

      // Retrieve all creatives which match.
      CreativePage page =
          creativeService.getCreativesByStatement(statementBuilder.toStatement());

      if (page.getResults() != null) {
        Creative[] creatives = page.getResults();
        long[] oldIds = new long[creatives.length];
        for (int i = 0; i < creatives.length; i++) {
          ImageCreative imageCreative = (ImageCreative) creatives[i];
          oldIds[i] = imageCreative.getId();
          imageCreative.setId(null);
View Full Code Here

      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (Creative creative : page.getResults()) {
          System.out.println(i + ") Creative with ID \"" + creative.getId()
              + "\", name \"" + creative.getName()
              + "\", and type \"" + creative.getCreativeType() + "\" was found.");
          i++;
        }
      }

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

      Statement filterStatement =
          new StatementBuilder("WHERE creativeType = :creativeType LIMIT 500")
              .putValue("creativeType", ImageCreative.class.getSimpleName()).toStatement();

      // Get creatives by statement.
      CreativePage page = creativeService.getCreativesByStatement(filterStatement);

      if (page.getResults() != null) {
        Creative[] creatives = page.getResults();

        // Update each local creative object by changing its destination URL.
        for (Creative creative : creatives) {
          if (creative instanceof ImageCreative) {
            ImageCreative imageCreative = (ImageCreative) creative;
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201302.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.