Package com.google.api.ads.dfa.axis.v1_20

Examples of com.google.api.ads.dfa.axis.v1_20.Placement


      long dfaSiteId, long campaignId, int pricingType, long sizeId) throws Exception {
    // Request the placement service from the service client factory.
    PlacementRemote placementService = dfaServices.get(session, PlacementRemote.class);

    // Create the placement.
    Placement placement = new Placement();
    placement.setId(0);
    placement.setName(placementName);
    placement.setCampaignId(campaignId);
    placement.setDfaSiteId(dfaSiteId);
    placement.setSizeId(sizeId);
    // The type ID for regular agency paid placements is 3. See
    // GetPlacementTypes.java
    placement.setPlacementType(3);

    // Set the pricing schedule for the placement.
    PricingSchedule pricingSchedule = new PricingSchedule();
    Calendar startDate = Calendar.getInstance();
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.MONTH, 1);
    pricingSchedule.setStartDate(startDate);
    pricingSchedule.setEndDate(endDate);
    pricingSchedule.setPricingType(pricingType);
    placement.setPricingSchedule(pricingSchedule);

    // Set the placement tag settings.
    TagSettings tagSettings = new TagSettings();
    PlacementTagOption[] placementTagOptions = placementService.getRegularPlacementTagOptions();
    int[] tagTypes = new int[placementTagOptions.length];

    for (int i = 0; i < placementTagOptions.length; i++) {
      tagTypes[i] = (int) placementTagOptions[i].getId();
    }

    tagSettings.setTagTypes(tagTypes);
    placement.setTagSettings(tagSettings);

    // Save the placement.
    PlacementSaveResult placementSaveResult = placementService.savePlacement(placement);

    // Display the new placement ID.
View Full Code Here


    AdvertiserGroupSearchCriteria advGroupSearchCriteria = new AdvertiserGroupSearchCriteria();
    advGroupSearchCriteria.setPageSize(10);
    advGroupSearchCriteria.setSearchString(searchString);

    // Get advertiser group record set.
    AdvertiserGroupRecordSet advertiserGroupRecordSet =
        service.getAdvertiserGroups(advGroupSearchCriteria);

    // Display advertiser group names, IDs and advertiser count.
    if (advertiserGroupRecordSet.getRecords() != null) {
      for (AdvertiserGroup result : advertiserGroupRecordSet.getRecords()) {
        System.out.println("Advertiser Group with name \"" + result.getName()
            + "\", ID \"" + result.getId()
            + "\", containing " + result.getAdvertiserCount()
            + " advertisers was found.");
      }
View Full Code Here

  private static final String SEARCH_STRING = "INSERT_SEARCH_CRITERIA_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String searchString) throws Exception {
    // Request the service.
    AdvertiserGroupRemote service = dfaServices.get(session, AdvertiserGroupRemote.class);

    // Create advertiser group search criteria structure.
    AdvertiserGroupSearchCriteria advGroupSearchCriteria = new AdvertiserGroupSearchCriteria();
    advGroupSearchCriteria.setPageSize(10);
    advGroupSearchCriteria.setSearchString(searchString);

    // Get advertiser group record set.
    AdvertiserGroupRecordSet advertiserGroupRecordSet =
        service.getAdvertiserGroups(advGroupSearchCriteria);

    // Display advertiser group names, IDs and advertiser count.
    if (advertiserGroupRecordSet.getRecords() != null) {
      for (AdvertiserGroup result : advertiserGroupRecordSet.getRecords()) {
        System.out.println("Advertiser Group with name \"" + result.getName()
View Full Code Here

      DfaServices dfaServices, DfaSession session, String searchString) throws Exception {
    // Request the service.
    AdvertiserGroupRemote service = dfaServices.get(session, AdvertiserGroupRemote.class);

    // Create advertiser group search criteria structure.
    AdvertiserGroupSearchCriteria advGroupSearchCriteria = new AdvertiserGroupSearchCriteria();
    advGroupSearchCriteria.setPageSize(10);
    advGroupSearchCriteria.setSearchString(searchString);

    // Get advertiser group record set.
    AdvertiserGroupRecordSet advertiserGroupRecordSet =
        service.getAdvertiserGroups(advGroupSearchCriteria);
View Full Code Here

    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
            result.getSpotId());
      }

      advSearchCriteria.setPageNumber(advSearchCriteria.getPageNumber() + 1);
    } while (advSearchCriteria.getPageNumber() <= advertiserRecordSet.getTotalNumberOfPages());

    System.out.printf("Number of results found: %s%n",
        advertiserRecordSet.getTotalNumberOfRecords());
  }
View Full Code Here

*/
public class GetAdvertisers {

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create advertiser search criteria structure.
    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
View Full Code Here

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    // Request the advertiser service from the service client factory.
    AdvertiserRemote advertiserService = dfaServices.get(session, AdvertiserRemote.class);

    // Create advertiser search criteria structure.
    AdvertiserSearchCriteria advSearchCriteria = new AdvertiserSearchCriteria();
    advSearchCriteria.setPageSize(100);
    // When paging, start counting page numbers from 1 rather than 0.
    advSearchCriteria.setPageNumber(1);

    AdvertiserRecordSet advertiserRecordSet;
    int i = 1;

    do {
      // Get advertisers by criteria.
      advertiserRecordSet = advertiserService.getAdvertisers(
          advSearchCriteria);

      for (Advertiser result : advertiserRecordSet.getRecords()) {
        System.out.printf("%s) Advertiser with name \"%s\", ID \"%s\", and spotlight " +
            "configuration ID \"%s\" was found.%n", i++, result.getName(), result.getId(),
            result.getSpotId());
      }

      advSearchCriteria.setPageNumber(advSearchCriteria.getPageNumber() + 1);
    } while (advSearchCriteria.getPageNumber() <= advertiserRecordSet.getTotalNumberOfPages());

    System.out.printf("Number of results found: %s%n",
        advertiserRecordSet.getTotalNumberOfRecords());
  }
View Full Code Here

      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
View Full Code Here

    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
    if (changeLogRecordSet.getRecords() != null) {
      for (ChangeLogRecord result : changeLogRecordSet.getRecords()) {
        System.out.println("Action \"" + result.getAction()
            + "\", Context \"" +  result.getContext()
            + "\", Change Date \"" + dateFormat.format(result.getChangeDate().getTime())
            + "\", New Value \"" + result.getNewValue()
            + "\", Old Value \"" + result.getOldValue()
View Full Code Here

  private static final String ADVERTISER_ID = "INSERT_ADVERTISER_ID_HERE";

  public static void runExample(
      DfaServices dfaServices, DfaSession session, long advertiserId) throws Exception {
    // Request the service.
    ChangeLogRemote service = dfaServices.get(session, ChangeLogRemote.class);

    // Create change log search criteria structure.
    ChangeLogRecordSearchCriteria searchCriteria = new ChangeLogRecordSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setObjectId(advertiserId);
    // The following field has been filled in to choose advertiser change
    // logs. This values was determined using GetChangeLogObjectTypes.java.
    searchCriteria.setObjectTypeId(1L);

    // Get change log record set.
    ChangeLogRecordSet changeLogRecordSet = service.getChangeLogRecords(searchCriteria);

    // Set up a formatter to make the change log timestamps human-readable.
    SimpleDateFormat dateFormat = new SimpleDateFormat("d MMM yyyy HH:mm");

    // Display the contents of each change log record
View Full Code Here

TOP

Related Classes of com.google.api.ads.dfa.axis.v1_20.Placement

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.