Examples of ThirdPartySlotServiceInterface


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

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      // Set the company ID to associate with this third party slot.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Set the external unique ID to associate with this third party slot.
      String externalUniqueId = "INSERT_EXTERNAL_UNIQUE_ID_HERE";

      // Set the external unique name to associate with this third party slot.
      String externalUniqueName = "INSERT_EXTERNAL_UNIQUE_NAME_HERE";

      // Set the creative IDs to associate with this third party slot.
      long[] creativeIds = new long[] {Long.parseLong("INSERT_CREATIVE_ID_HERE")};

      // Create the ThirdPartySlot object.
      ThirdPartySlot thirdPartySlot = new ThirdPartySlot();
      thirdPartySlot.setCompanyId(companyId);
      thirdPartySlot.setDescription("Third party slot description.");
      thirdPartySlot.setExternalUniqueId(externalUniqueId);
      thirdPartySlot.setExternalUniqueName(externalUniqueName);

      // Set the creatives that the third party slots will represent.
      thirdPartySlot.setCreativeIds(creativeIds);

      // Create the third party slot.
      thirdPartySlot = thirdPartySlotService.createThirdPartySlot(thirdPartySlot);

      if (thirdPartySlot != null) {
        System.out.println("A third party slot with ID \"" + thirdPartySlot.getId()
            + "\" and named \"" + thirdPartySlot.getExternalUniqueName() + "\" was created.");
      } else {
View Full Code Here

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

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdpartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      //Set the company that the third party slots to archive belong to.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");
     
      // Create a statement to only select active third party slots.
      String statementText = "WHERE status = :status AND "
          + "companyId = :companyId LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("")
            .putValue("status", ThirdPartySlotStatus.ACTIVE.toString())
            .putValue("companyId", companyId)
            .toStatement();

      // Set defaults for page and offset.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      int offset = 0;
      int i = 0;
      List<Long> thirdPartySlotIds = new ArrayList<Long>();

      do {
        // Create a statement to page through active third party slots.
        filterStatement.setQuery(statementText + " OFFSET " + offset);

        // Get third party slots by statement.
        page = thirdpartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.getResults() != null) {
          for (ThirdPartySlot thirdPartySlot : page.getResults()) {
            System.out.println("Third party slot with ID \"" + thirdPartySlot.getId()
                + "\" will be archived.");
            thirdPartySlotIds.add(thirdPartySlot.getId());
          }
        }

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

      System.out.println("Number of third party slots to be archived: "
          + thirdPartySlotIds.size());

      if (thirdPartySlotIds.size() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE id IN ("
            + StringUtils.join(thirdPartySlotIds, ",") + ")");

        // Create action.
        ArchiveThirdPartySlots action = new ArchiveThirdPartySlots();

        // Perform action.
        UpdateResult result =
            thirdpartySlotService.performThirdPartySlotAction(action, filterStatement);

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of third party slots archived: " + result.getNumChanges());
        } else {
View Full Code Here

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

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      // Sets defaults for page and filterStatement.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500 ").putValue("status",
              ThirdPartySlotStatus.ARCHIVED.toString()).toStatement();

      // Get third party slots by statement.
      page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (ThirdPartySlot thirdPartySlot : page.getResults()) {
          System.out.println(i + ") Third party slot with ID \"" + thirdPartySlot.getId()
View Full Code Here

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

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

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

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

        // Get third party slots by statement.
        page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (ThirdPartySlot thirdPartySlot : page.getResults()) {
            System.out.println(i + ") Third party slot with ID \""
View Full Code Here

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

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201208.THIRD_PARTY_SLOT_SERVICE);

      // Create a statement to get one active third party slot.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 1")
              .putValue("status", ThirdPartySlotStatus.ACTIVE.toString()).toStatement();

      // Get third party slot by statement.
      ThirdPartySlotPage page =
          thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
     
      if (page.getResults() != null) {
        ThirdPartySlot[] thirdPartySlots = page.getResults();

        // Update each local third party slot by changing its description.
        for (ThirdPartySlot thirdPartySlot : thirdPartySlots) {
          thirdPartySlot.setDescription("Updated description");
         
          // Update the third party slot on the server.
          thirdPartySlot = thirdPartySlotService.updateThirdPartySlot(thirdPartySlot);
         
          // Display results.
          if (thirdPartySlot != null) {
            System.out.println("A third party slot with ID \"" + thirdPartySlot.getId()
              + "\" and description \"" + thirdPartySlot.getDescription() + "\" was updated.");
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.ThirdPartySlotServiceInterface

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201211.THIRD_PARTY_SLOT_SERVICE);

      // Set the company ID to associate with this third party slot.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");

      // Set the external unique ID to associate with this third party slot.
      String externalUniqueId = "INSERT_EXTERNAL_UNIQUE_ID_HERE";

      // Set the external unique name to associate with this third party slot.
      String externalUniqueName = "INSERT_EXTERNAL_UNIQUE_NAME_HERE";

      // Set the creative IDs to associate with this third party slot.
      long[] creativeIds = new long[] {Long.parseLong("INSERT_CREATIVE_ID_HERE")};

      // Create the ThirdPartySlot object.
      ThirdPartySlot thirdPartySlot = new ThirdPartySlot();
      thirdPartySlot.setCompanyId(companyId);
      thirdPartySlot.setDescription("Third party slot description.");
      thirdPartySlot.setExternalUniqueId(externalUniqueId);
      thirdPartySlot.setExternalUniqueName(externalUniqueName);

      // Set the creatives that the third party slots will represent.
      thirdPartySlot.setCreativeIds(creativeIds);

      // Create the third party slot.
      thirdPartySlot = thirdPartySlotService.createThirdPartySlot(thirdPartySlot);

      if (thirdPartySlot != null) {
        System.out.println("A third party slot with ID \"" + thirdPartySlot.getId()
            + "\" and named \"" + thirdPartySlot.getExternalUniqueName() + "\" was created.");
      } else {
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.ThirdPartySlotServiceInterface

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdpartySlotService =
          user.getService(DfpService.V201211.THIRD_PARTY_SLOT_SERVICE);

      //Set the company that the third party slots to archive belong to.
      Long companyId = Long.parseLong("INSERT_COMPANY_ID_HERE");
     
      // Create a statement to only select active third party slots.
      String statementText = "WHERE status = :status AND "
          + "companyId = :companyId LIMIT 500";
      Statement filterStatement =
          new StatementBuilder("")
            .putValue("status", ThirdPartySlotStatus.ACTIVE.toString())
            .putValue("companyId", companyId)
            .toStatement();

      // Set defaults for page and offset.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      int offset = 0;
      int i = 0;
      List<Long> thirdPartySlotIds = new ArrayList<Long>();

      do {
        // Create a statement to page through active third party slots.
        filterStatement.setQuery(statementText + " OFFSET " + offset);

        // Get third party slots by statement.
        page = thirdpartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.getResults() != null) {
          for (ThirdPartySlot thirdPartySlot : page.getResults()) {
            System.out.println("Third party slot with ID \"" + thirdPartySlot.getId()
                + "\" will be archived.");
            thirdPartySlotIds.add(thirdPartySlot.getId());
          }
        }

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

      System.out.println("Number of third party slots to be archived: "
          + thirdPartySlotIds.size());

      if (thirdPartySlotIds.size() > 0) {
        // Modify statement for action.
        filterStatement.setQuery("WHERE id IN ("
            + StringUtils.join(thirdPartySlotIds, ",") + ")");

        // Create action.
        ArchiveThirdPartySlots action = new ArchiveThirdPartySlots();

        // Perform action.
        UpdateResult result =
            thirdpartySlotService.performThirdPartySlotAction(action, filterStatement);

        // Display results.
        if (result != null && result.getNumChanges() > 0) {
          System.out.println("Number of third party slots archived: " + result.getNumChanges());
        } else {
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.ThirdPartySlotServiceInterface

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201211.THIRD_PARTY_SLOT_SERVICE);

      // Sets defaults for page and filterStatement.
      ThirdPartySlotPage page = new ThirdPartySlotPage();
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 500 ").putValue("status",
              ThirdPartySlotStatus.ARCHIVED.toString()).toStatement();

      // Get third party slots by statement.
      page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

      if (page.getResults() != null) {
        int i = page.getStartIndex();
        for (ThirdPartySlot thirdPartySlot : page.getResults()) {
          System.out.println(i + ") Third party slot with ID \"" + thirdPartySlot.getId()
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.ThirdPartySlotServiceInterface

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201211.THIRD_PARTY_SLOT_SERVICE);

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

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

        // Get third party slots by statement.
        page = thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);

        if (page.getResults() != null) {
          int i = page.getStartIndex();
          for (ThirdPartySlot thirdPartySlot : page.getResults()) {
            System.out.println(i + ") Third party slot with ID \""
View Full Code Here

Examples of com.google.api.ads.dfp.v201211.ThirdPartySlotServiceInterface

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

      // Get the ThirdPartySlotService.
      ThirdPartySlotServiceInterface thirdPartySlotService =
          user.getService(DfpService.V201211.THIRD_PARTY_SLOT_SERVICE);

      // Create a statement to get one active third party slot.
      Statement filterStatement =
          new StatementBuilder("WHERE status = :status LIMIT 1")
              .putValue("status", ThirdPartySlotStatus.ACTIVE.toString()).toStatement();

      // Get third party slot by statement.
      ThirdPartySlotPage page =
          thirdPartySlotService.getThirdPartySlotsByStatement(filterStatement);
     
      if (page.getResults() != null) {
        ThirdPartySlot[] thirdPartySlots = page.getResults();

        // Update each local third party slot by changing its description.
        for (ThirdPartySlot thirdPartySlot : thirdPartySlots) {
          thirdPartySlot.setDescription("Updated description");
         
          // Update the third party slot on the server.
          thirdPartySlot = thirdPartySlotService.updateThirdPartySlot(thirdPartySlot);
         
          // Display results.
          if (thirdPartySlot != null) {
            System.out.println("A third party slot with ID \"" + thirdPartySlot.getId()
              + "\" and description \"" + thirdPartySlot.getDescription() + "\" was updated.");
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.