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

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


      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());
      }

      creativeSearchCriteria.setPageNumber(creativeSearchCriteria.getPageNumber() + 1);
    } while (creativeSearchCriteria.getPageNumber() <= creatives.getTotalNumberOfPages());

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


    DfaSiteSearchCriteria searchCriteria = new DfaSiteSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setSearchString(searchString);

    // Get the sites.
    DfaSiteRecordSet dfaSiteRecordSet = service.getDfaSites(searchCriteria);

    // Display DFA site names and IDs.
    if (dfaSiteRecordSet.getRecords() != null) {
      for (DfaSite result : dfaSiteRecordSet.getRecords()) {
        System.out.println("DFA site with name \"" + result.getName()
            + "\" and ID \"" + result.getId() + "\" was found.");
      }
    } else {
      System.out.print("No DFA sites found for your search criteria.");
View Full Code Here

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

    // Create DFA site search criteria structure.
    DfaSiteSearchCriteria searchCriteria = new DfaSiteSearchCriteria();
    searchCriteria.setPageSize(10);
    searchCriteria.setSearchString(searchString);

    // Get the sites.
    DfaSiteRecordSet dfaSiteRecordSet = service.getDfaSites(searchCriteria);

    // Display DFA site names and IDs.
View Full Code Here

    // 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);
View Full Code Here

    inStreamVideoAsset.setName(assetName);
    inStreamVideoAsset.setContent(Media.getMediaDataFromFile(pathToFile));

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

    // Save the media file.
    InStreamVideoCreative inStreamVideoCreative =
        creativeService.uploadInStreamAsset(inStreamAssetUploadRequest);
View Full Code Here

    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);
View Full Code Here

    inStreamAssetUploadRequest.setMediaFile(true);
    inStreamAssetUploadRequest.setInStreamAsset(inStreamVideoAsset);
    inStreamAssetUploadRequest.setCreativeId(creativeId);

    // Save the media file.
    InStreamVideoCreative inStreamVideoCreative =
        creativeService.uploadInStreamAsset(inStreamAssetUploadRequest);

    // Display a success message.
    System.out.printf("Added a media file to In-Stream video creative with ID \"%s\".%n",
        inStreamVideoCreative.getId());
  }
View Full Code Here

    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 =
View Full Code Here

    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

  public static void runExample(DfaServices dfaServices, DfaSession session) throws Exception {
    String username = session.getUsername();
    String password = session.getPassword();

    // Request the login service from the service client factory.
    LoginRemote loginService = dfaServices.get(session, LoginRemote.class);

    // Authenticate.
    UserProfile userProfile = loginService.authenticate(username, password);

    // Display user profile token, DFA account name and ID.
    System.out.printf("User profile token is \"%s\", DFA account name is \"%s\", and DFA " +
        "account ID is \"%s\".%n", userProfile.getToken(), userProfile.getNetworkName(),
        userProfile.getNetworkId());
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.