Examples of ReportDownloadResponse


Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    reportDefinition.setDownloadFormat(DownloadFormat.CSV);
    // Enable to allow rows with zero impressions to show.
    reportDefinition.setIncludeZeroImpressions(true);
    reportDefinition.setSelector(reportSelector);

    ReportDownloadResponse response =
        new ReportDownloader(session).downloadReport(reportDefinition);
    if (response.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } else {
      System.out.println("Report was not downloaded. " + response.getHttpStatus() + ": "
          + response.getHttpResponseMessage());
    }
  }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(reportDefinition);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

   */
  @VisibleForTesting
  ReportDownloadResponse handleResponse(RawReportDownloadResponse response)
      throws ReportDownloadResponseException {
    if (response.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      return new ReportDownloadResponse(
          response.getHttpStatus(), "SUCCESS", response.getInputStream());
    }
    String responseText;
    try {
      responseText = Streams.readAll(response.getInputStream());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

   */
  @VisibleForTesting
  ReportDownloadResponse handleResponse(RawReportDownloadResponse response)
      throws ReportDownloadResponseException {
    if (response.getHttpStatus() == HttpURLConnection.HTTP_OK) {
      return new ReportDownloadResponse(
          response.getHttpStatus(), "SUCCESS", response.getInputStream());
    }
    String responseText;
    try {
      responseText = Streams.readAll(response.getInputStream());
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(reportDefinition);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(query, DownloadFormat.CSV);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try
    {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response = new ReportDownloader(session).downloadReport(reportDefinition);
      // FileOutputStream fos = new FileOutputStream(new File(reportFile));
      // Streams.copy(response.getInputStream(), fos);
      // fos.close();
      // System.out.println("Report successfully downloaded: " + reportFile);
      output = getStringFromInputStream (response.getInputStream());
      System.out.println (output);
    }
    catch (ReportDownloadResponseException e)
    {
      System.out.println("Report was not downloaded. " + e);
View Full Code Here

Examples of com.google.api.ads.adwords.lib.utils.ReportDownloadResponse

    try {
      // Set the property api.adwords.reportDownloadTimeout or call
      // ReportDownloader.setReportDownloadTimeout to set a timeout (in milliseconds)
      // for CONNECT and READ in report downloads.
      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(reportDefinition);
      FileOutputStream fos = new FileOutputStream(new File(reportFile));
      Streams.copy(response.getInputStream(), fos);
      fos.close();
      System.out.println("Report successfully downloaded: " + reportFile);
    } catch (ReportDownloadResponseException e) {
      System.out.println("Report was not downloaded. " + e);
    }
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.