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

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


  public static void runExample(
      DfaServices dfaServices, DfaSession session, String creativeName, String assetFileName,
      long advertiserId, long sizeId, long campaignId) throws Exception {

    // Request the creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Create the image creative.
    ImageCreative imageCreative = new ImageCreative();
    imageCreative.setId(0);
    imageCreative.setName(creativeName);
    imageCreative.setActive(true);
    imageCreative.setAdvertiserId(advertiserId);
    imageCreative.setSizeId(sizeId);
    imageCreative.setAssetFilename(assetFileName);
    // The type ID for image creatives is 1. See GetCreativeTypes.java
    imageCreative.setTypeId(1);

    // Save the image creative.
    CreativeSaveResult creativeSaveResult = creativeService.saveCreative(imageCreative,
        campaignId);

    // Display the new creative ID.
    System.out.printf("Image creative with ID \"%s\" was created.%n",
        creativeSaveResult.getId());
View Full Code Here


*/
public class GetCreativeTypes {

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

    // Get creative types.
    CreativeType[] creativeTypes = service.getCreativeTypes();

    // Display creative types and IDs.
    for (CreativeType result : creativeTypes){
      System.out.println("Creative type name \"" + result.getName()
          + "\" with ID \"" + result.getId() + "\" was found.");
View Full Code Here

  public static void runExample(
      DfaServices dfaServices, DfaSession session, long[] creativeIds, long[] placementIds)
          throws Exception {
    // Request the creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Create creative placement assignment structure.
    CreativePlacementAssignment[] creativePlacementAssignment =
        new CreativePlacementAssignment[creativeIds.length];

    for (int i = 0; i < creativeIds.length; i++){
      creativePlacementAssignment[i] = new CreativePlacementAssignment();
      creativePlacementAssignment[i].setCreativeId(creativeIds[i]);
      creativePlacementAssignment[i].setPlacementId(placementIds[0]);
      creativePlacementAssignment[i].setPlacementIds(placementIds);
    }

    // Assign creatives to placements.
    CreativePlacementAssignmentResult[] creativeAssigmentResult =
      creativeService.assignCreativesToPlacements(creativePlacementAssignment);

    // Display new ads that resulted from the assignment.
    for (CreativePlacementAssignmentResult result : creativeAssigmentResult) {
      System.out.printf("Ad with name \"%s\" and ID \"%s\" was created.%n",
          result.getAdName(), result.getAdId());
View Full Code Here

  private static final String CREATIVE_ID = "INSERT_IN_STREAM_VIDEO_CREATIVE_ID_HERE";

  public static void runExample(DfaServices dfaServices, DfaSession session, long creativeId)
      throws Exception {
    // Request the creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Fetch the In-Stream video creative which contains the asset to modify.
    CreativeBase rawCreative = creativeService.getCreative(creativeId);

    if (!(rawCreative instanceof InStreamVideoCreative)) {
      System.out.printf("Unable to update creative with ID \"%s\": not an In-Stream video "
          + "creative.", creativeId);
    } else {
      InStreamVideoCreative inStreamVideoCreative = (InStreamVideoCreative) rawCreative;

      // Modify the media files, companion ads, and/or non-linear ads.
      if (inStreamVideoCreative.getMediaFiles() != null) {
        for (InStreamMediaFile mediaFile : inStreamVideoCreative.getMediaFiles()) {
          mediaFile.setPickedToServe(!mediaFile.isPickedToServe());
        }
      }

      if (inStreamVideoCreative.getCompanionAds() != null) {
        for (InStreamCompanionAd companionAd : inStreamVideoCreative.getCompanionAds()) {
          companionAd.setAltText(companionAd.getAltText() + " Updated.");
        }
      }

      if (inStreamVideoCreative.getNonLinearAds() != null) {
        for (InStreamNonLinearAd nonLinearAd : inStreamVideoCreative.getNonLinearAds()) {
          nonLinearAd.setScalable(!nonLinearAd.isScalable());
        }
      }

      CreativeSaveResult creativeSaveResult =
          creativeService.saveCreative(inStreamVideoCreative, 0);

      System.out.printf("Updated the In-Stream assets of In-Stream video creative with ID "
          + "\"%s\".%n", creativeSaveResult.getId());
    }
  }
View Full Code Here

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

    // Create the mobile asset.
    CreativeAsset mobileAsset = new CreativeAsset();
    mobileAsset.setName(assetName);
    mobileAsset.setContent(Media.getMediaDataFromFile(pathToFile));
    mobileAsset.setForHTMLCreatives(true);
    mobileAsset.setAdvertiserId(advertiserId);

    // Save the mobile asset.
    CreativeAssetSaveResult creativeAssetSaveResult = service.saveCreativeAsset(mobileAsset);

    // Display the new asset file name.
    System.out.printf("Asset was saved with file name of \"%s\".%n",
        creativeAssetSaveResult.getSavedFilename());
  }
View Full Code Here

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String assetName, String pathToFile,
      long advertiserId) throws Exception {
    // Request the creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Create the image asset.
    CreativeAsset imgAsset = new CreativeAsset();
    imgAsset.setForHTMLCreatives(false);
    imgAsset.setName(assetName);
    imgAsset.setContent(Media.getMediaDataFromFile(pathToFile));
    imgAsset.setAdvertiserId(advertiserId);

    // Save the image asset.
    CreativeAssetSaveResult creativeAssetSaveResult = creativeService.saveCreativeAsset(
        imgAsset);

    // Display the new asset file name.
    System.out.printf("Asset was saved with file name of \"%s\".%n",
        creativeAssetSaveResult.getSavedFilename());
View Full Code Here

  public static void runExample(
      DfaServices dfaServices, DfaSession session, String assetName, String pathToFile,
      long creativeId, String assetToReplace) throws Exception {
    // Request the creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Create the In-Stream creative asset.
    CreativeAsset inStreamVideoAsset = new CreativeAsset();
    inStreamVideoAsset.setName(assetName);
    inStreamVideoAsset.setContent(Media.getMediaDataFromFile(pathToFile));

    // Create an upload request to make this asset a companion ad file for an
    // existing In-Stream video creative.
    InStreamAssetUploadRequest inStreamAssetUploadRequest = new InStreamAssetUploadRequest();
    inStreamAssetUploadRequest.setCompanion(true);
    inStreamAssetUploadRequest.setInStreamAsset(inStreamVideoAsset);
    inStreamAssetUploadRequest.setCreativeId(creativeId);

    // Replace the existing asset with a newly uploaded asset.
    InStreamVideoCreative inStreamVideoCreative =
        creativeService.replaceInStreamAsset(assetToReplace, inStreamAssetUploadRequest);

    // Display a success message.
    System.out.printf("Replaced companion ad asset \"%s\" in In-Stream video creative "
        + "with ID \"%s\".%n", assetToReplace, inStreamVideoCreative.getId());
  }
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 creative service from the service client factory.
    CreativeRemote creativeService = dfaServices.get(session, CreativeRemote.class);

    // Set up creative search criteria structure.
    CreativeSearchCriteria creativeSearchCriteria = new CreativeSearchCriteria();
    creativeSearchCriteria.setPageSize(100);
    creativeSearchCriteria.setAdvertiserId(advertiserId);
    // When paging, start counting page numbers from 1 rather than 0.
    creativeSearchCriteria.setPageNumber(1);

    CreativeRecordSet creatives;
    int i = 1;

    do {
      // Get creatives for the selected criteria.
      creatives = creativeService.getCreatives(creativeSearchCriteria);

      for (CreativeBase result : creatives.getRecords()) {
        System.out.printf("%s) Creative with name \"%s\" and ID \"%s\" was found.%n",
            i++, result.getName(), result.getId());
      }
View Full Code Here

    imageCreative.setAssetFilename(assetFileName);
    // The type ID for image creatives is 1. See GetCreativeTypes.java
    imageCreative.setTypeId(1);

    // Save the image creative.
    CreativeSaveResult creativeSaveResult = creativeService.saveCreative(imageCreative,
        campaignId);

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

        for (InStreamNonLinearAd nonLinearAd : inStreamVideoCreative.getNonLinearAds()) {
          nonLinearAd.setScalable(!nonLinearAd.isScalable());
        }
      }

      CreativeSaveResult creativeSaveResult =
          creativeService.saveCreative(inStreamVideoCreative, 0);

      System.out.printf("Updated the In-Stream assets of In-Stream video creative with ID "
          + "\"%s\".%n", creativeSaveResult.getId());
    }
  }
View Full Code Here

TOP

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

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.