Package com.google.api.ads.dfp.v201306

Examples of com.google.api.ads.dfp.v201306.ActivityServiceInterface


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

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

      // Set the IDs of the companies for the contacts.
      Long advertiserCompanyId = Long.parseLong("INSERT_ADVERTISER_COMPANY_ID_HERE");
      Long agencyCompanyId = Long.parseLong("INSERT_AGENCY_COMPANY_ID_HERE");

      // Create an advertiser contact.
      Contact advertiserContact = new Contact();
      advertiserContact.setName("Mr. Advertiser #" + new Random().nextLong());
      advertiserContact.setEmail("advertiser@advertising.com");
      advertiserContact.setCompanyId(advertiserCompanyId);

      // Create an agency contact.
      Contact agencyContact = new Contact();
      agencyContact.setName("Ms. Agency #" + new Random().nextLong());
      agencyContact.setEmail("agency@agencies.com");
      agencyContact.setCompanyId(agencyCompanyId);

      // Create the contacts on the server.
      Contact[] contacts =
          contactService.createContacts(new Contact[] {advertiserContact, agencyContact});

      for (Contact contact : contacts) {
        System.out.printf("A contact with ID \"%d\" and name \"%s\" was created.\n",
            contact.getId(), contact.getName());
      }
View Full Code Here


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

      // Get the ContactService.
      ContactServiceInterface contactService =
          user.getService(DfpService.V201306.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

      // Set the ID of the creative template to get.
      Long creativeTemplateId = Long.parseLong("INSERT_CREATIVE_TEMPLATE_ID_HERE");

      // Get the creative template.
      CreativeTemplate creativeTemplate =
          creativeTemplateService.getCreativeTemplate(creativeTemplateId);

      if (creativeTemplate != null) {
        System.out.println("Creative template with ID \"" + creativeTemplate.getId()
             + "\", name \"" + creativeTemplate.getName()
             + "\", and type \"" + creativeTemplate.getType() + "\" was found.");
        for (CreativeTemplateVariable variable : creativeTemplate.getVariables()) {
          System.out.println("Variable with name \"" + variable.getUniqueName() + "\" is "
              + (variable.getIsRequired() ? "required." : "optional."));
        }
      } else {
        System.out.println("No creative template found for this ID.");
View Full Code Here

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

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

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

        // Get creative templates by statement.
        page = creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

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

        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 type = :creativeTemplateType LIMIT 500").putValue(
              "creativeTemplateType", CreativeTemplateType.SYSTEM_DEFINED.toString()).toStatement();

      // Get creative templates by statement.
      CreativeTemplatePage page =
          creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (CreativeTemplate creativeTemplate : page.getResults()) {
          System.out.println(i + ") Creative template with ID \"" + creativeTemplate.getId()
              + "\", name \"" + creativeTemplate.getName()
              + "\", and type \"" + creativeTemplate.getType() + "\" 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 CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

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

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

        // Get creative templates by statement.
        page = creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (CreativeTemplate creativeTemplate : page.getResults()) {
            System.out.println(i + ") Creative template with ID \"" + creativeTemplate.getId()
View Full Code Here

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

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

      // Set the ID of the creative template to get.
      Long creativeTemplateId = Long.parseLong("INSERT_CREATIVE_TEMPLATE_ID_HERE");

      // Get the creative template.
      CreativeTemplate creativeTemplate =
          creativeTemplateService.getCreativeTemplate(creativeTemplateId);

      if (creativeTemplate != null) {
        System.out.println("Creative template with ID \"" + creativeTemplate.getId()
             + "\", name \"" + creativeTemplate.getName()
             + "\", and type \"" + creativeTemplate.getType() + "\" was found.");
View Full Code Here

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

      // Get the CreativeTemplateService.
      CreativeTemplateServiceInterface creativeTemplateService =
          user.getService(DfpService.V201306.CREATIVE_TEMPLATE_SERVICE);

      // Create a statement to only select system defined creative templates.
      Statement filterStatement =
          new StatementBuilder("WHERE type = :creativeTemplateType LIMIT 500").putValue(
              "creativeTemplateType", CreativeTemplateType.SYSTEM_DEFINED.toString()).toStatement();

      // Get creative templates by statement.
      CreativeTemplatePage page =
          creativeTemplateService.getCreativeTemplatesByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (CreativeTemplate creativeTemplate : page.getResults()) {
          System.out.println(i + ") Creative template with ID \"" + creativeTemplate.getId()
View Full Code Here

   */
  public static Date fromDate(java.util.Date date) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);

    Date dfpDate = new Date();
    dfpDate.setYear(calendar.get(Calendar.YEAR));
    dfpDate.setMonth(calendar.get(Calendar.MONTH) + 1);
    dfpDate.setDay(calendar.get(Calendar.DAY_OF_MONTH));

    return dfpDate;
  }
View Full Code Here

   * @param date the DFP {@code Date} object to convert to a Java {@code Date}
   * @param timeZoneId the timezone of the date
   * @return the DFP {@code Date} object as a Java {@code Date} in the timezone
   */
  public static java.util.Date toDate(Date date, String timeZoneId) {
    return DateTimeUtils.toDate(new DateTime(date, 0, 0, 0, timeZoneId));
  }
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfp.v201306.ActivityServiceInterface

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.