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

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


  private static final String PLACEMENT_ID = "INSERT_PLACEMENT_ID_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, String adName,
      long campaignId, long sizeId, long creativeId, long placementId) throws Exception {
    // Request the service.
    AdRemote service = dfaServices.get(session, AdRemote.class);

    // Create a rotation group.
    RotationGroup rotationGroup = new RotationGroup();
    rotationGroup.setId(0);
    rotationGroup.setName(adName);
    rotationGroup.setActive(true);
    rotationGroup.setArchived(false);
    rotationGroup.setCampaignId(campaignId);
    rotationGroup.setSizeId(sizeId);
    rotationGroup.setTypeId(1);
    rotationGroup.setPriority(12);
    rotationGroup.setRatio(1);

    // Set the ad start date. This example uses tomorrow's date.
    Calendar startTime = Calendar.getInstance();
    startTime.add(Calendar.DATE, 1);
    rotationGroup.setStartTime(startTime);

    // Set the ad end date. This example uses one month from today's date.
    Calendar endTime = Calendar.getInstance();
    endTime.add(Calendar.MONTH, 1);
    rotationGroup.setEndTime(endTime);

    // Add creatives to the ad.
    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.setActive(true);
    creativeAssignment.setCreativeId(creativeId);

    // Create the click through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.setDefaultLandingPageUsed(true);
    clickThroughUrl.setLandingPageId(0);
    creativeAssignment.setClickThroughUrl(clickThroughUrl);

    // Create the creative assignments.
    CreativeAssignment[] creativeAssignments = new CreativeAssignment[]{creativeAssignment};
    rotationGroup.setCreativeAssignments(creativeAssignments);
    rotationGroup.setRotationType(1);

    // Assign an ad to the placement.
    PlacementAssignment placementAssignment = new PlacementAssignment();
    placementAssignment.setActive(true);
    placementAssignment.setPlacementId(placementId);
    PlacementAssignment[] placementAssignments = new PlacementAssignment[]{placementAssignment};
    rotationGroup.setPlacementAssignments(placementAssignments);

    // Save the rotation group.
    AdSaveResult adSaveResult = service.saveAd(rotationGroup);

    // Display the new ad ID.
    System.out.printf("Ad with ID \"%s\" was created.%n", adSaveResult.getId());
  }
View Full Code Here


*/
public class GetAdTypes {

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

    // Get ad types.
    AdType[] adTypes = service.getAdTypes();

    // Display ad type and its ID.
    for (AdType result : adTypes) {
      System.out.println("Ad type with name \"" + result.getName()
          + "\" and ID \"" + result.getId() + "\" was found.");
View Full Code Here

  private static final String PLACEMENT_ID = "INSERT_PLACEMENT_ID_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, String adName,
      long campaignId, long sizeId, long creativeId, long placementId) throws Exception {
    // Request the service.
    AdRemote service = dfaServices.get(session, AdRemote.class);

    // Create a rotation group.
    RotationGroup rotationGroup = new RotationGroup();
    rotationGroup.setId(0);
    rotationGroup.setName(adName);
    rotationGroup.setActive(true);
    rotationGroup.setArchived(false);
    rotationGroup.setCampaignId(campaignId);
    rotationGroup.setSizeId(sizeId);
    rotationGroup.setTypeId(1);
    rotationGroup.setPriority(12);
    rotationGroup.setRatio(1);

    // Set the ad start date. This example uses tomorrow's date.
    Calendar startTime = Calendar.getInstance();
    startTime.add(Calendar.DATE, 1);
    rotationGroup.setStartTime(startTime);

    // Set the ad end date. This example uses one month from today's date.
    Calendar endTime = Calendar.getInstance();
    endTime.add(Calendar.MONTH, 1);
    rotationGroup.setEndTime(endTime);

    // Add creatives to the ad.
    CreativeAssignment creativeAssignment = new CreativeAssignment();
    creativeAssignment.setActive(true);
    creativeAssignment.setCreativeId(creativeId);

    // Create the click through URL.
    ClickThroughUrl clickThroughUrl = new ClickThroughUrl();
    clickThroughUrl.setDefaultLandingPageUsed(true);
    clickThroughUrl.setLandingPageId(0);
    creativeAssignment.setClickThroughUrl(clickThroughUrl);

    // Create the creative assignments.
    CreativeAssignment[] creativeAssignments = new CreativeAssignment[]{creativeAssignment};
    rotationGroup.setCreativeAssignments(creativeAssignments);
    rotationGroup.setRotationType(1);

    // Assign an ad to the placement.
    PlacementAssignment placementAssignment = new PlacementAssignment();
    placementAssignment.setActive(true);
    placementAssignment.setPlacementId(placementId);
    PlacementAssignment[] placementAssignments = new PlacementAssignment[]{placementAssignment};
    rotationGroup.setPlacementAssignments(placementAssignments);

    // Save the rotation group.
    AdSaveResult adSaveResult = service.saveAd(rotationGroup);

    // Display the new ad ID.
    System.out.printf("Ad with ID \"%s\" was created.%n", adSaveResult.getId());
  }
View Full Code Here

*/
public class GetAdTypes {

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

    // Get ad types.
    AdType[] adTypes = service.getAdTypes();

    // Display ad type and its ID.
    for (AdType result : adTypes) {
      System.out.println("Ad type with name \"" + result.getName()
          + "\" and ID \"" + result.getId() + "\" was found.");
View Full Code Here

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

    // Create advertiser group structure.
    AdvertiserGroup advertiserGroup = new AdvertiserGroup();
    advertiserGroup.setId(0);
    advertiserGroup.setName(advertiserGroupName);

    // Create advertiser group.
    AdvertiserGroupSaveResult advertiserGroupSaveResult =
        service.saveAdvertiserGroup(advertiserGroup);
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

  private static final String ADVERTISER_GROUP_NAME = "INSERT_ADVERTISER_GROUP_NAME_HERE";

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

    // Create advertiser group structure.
    AdvertiserGroup advertiserGroup = new AdvertiserGroup();
    advertiserGroup.setId(0);
    advertiserGroup.setName(advertiserGroupName);

    // Create advertiser group.
    AdvertiserGroupSaveResult advertiserGroupSaveResult =
        service.saveAdvertiserGroup(advertiserGroup);

    // Display advertiser group ID.
    System.out.printf("Advertiser Group with ID \"%s\" was created.",
        advertiserGroupSaveResult.getId());
  }
View Full Code Here

    AdvertiserGroup advertiserGroup = new AdvertiserGroup();
    advertiserGroup.setId(0);
    advertiserGroup.setName(advertiserGroupName);

    // Create advertiser group.
    AdvertiserGroupSaveResult advertiserGroupSaveResult =
        service.saveAdvertiserGroup(advertiserGroup);

    // Display advertiser group ID.
    System.out.printf("Advertiser Group with ID \"%s\" was created.",
        advertiserGroupSaveResult.getId());
  }
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

TOP

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

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.