Class AdWordReportService

Description

AdWords Lib Report Service Class

Report Service provides operations for getting reports about your AdWords account

Located in /services/AdWordReportService.inc

AdWordService
   |
   --AdWordReportService
Method Summary
 AdWordReportService AdWordReportService (string $soapToolkit)
 bool deleteReport (int $reportJobId, [string $clientEmail = ''])
 array|false getAllJobs ([string $clientEmail = ''])
 string|false getGzipReportDownloadUrl (int $reportJobId, [string $clientEmail = ''])
 string|false getReportDownloadUrl (int $reportJobId, [string $clientEmail = ''])
 string|false getReportJobStatus (int $reportJobId, [string $clientEmail = ''])
 int|false scheduleReportJob (object AdWordReportJob $job, [string $clientEmail = ''])
Methods

AdWordReportService Constructor. It takes one parameter - name of a supported by AdWords Lib SOAP toolkit

Example:

  1.  <?php
  2.  ?>
Please use defined constants for supported by AdWords Lib toolkit names

AdWordReportService AdWordReportService (string $soapToolkit)
  • string $soapToolkit: name of a supported by AdWords Lib SOAP Toolkit

Deletes a report job along with the report it produced, if any.

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$reportJobId - ID of the ReportJob
  4.  $response $reportService->deleteReport($reportJobId);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response == true
  11.  ?>

bool deleteReport (int $reportJobId, [string $clientEmail = ''])
  • int $reportJobId: ID of the ReportJob
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns an array consisting of all jobs the user has scheduled

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  $response $reportService->getAllJobs();
  4.  if ($response === false// if an error appears
  5.          $errr $classKW->getLastError()//get error object
  6.          echo $errr->toString()//output error
  7.          exit();
  8.  }
  9.  //$response is an array of objects of class AdWordReportJob
  10.  ?>

array|false getAllJobs ([string $clientEmail = ''])
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns a URL from which the report with the given job ID can be downloaded (in Gzip format)

After invoking this method, the caller can do a regular HTTP GET on the returned URL to retrieve the report.

NOTE: To extract the gzip archive use: $xmlFile=gzinflate(substr($downloadedFile,10));

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$reportJobId - ID of the ReportJob
  4.  $response $reportService->getGzipReportDownloadUrl($reportJobId);
  5.  if ($response === false// if an error appears
  6.          $errr $reportService->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response  - A URL from which the compressed report can be downloaded.
  11.  ?>

string|false getGzipReportDownloadUrl (int $reportJobId, [string $clientEmail = ''])
  • int $reportJobId: ID of the ReportJob
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns a URL from which the report with the given job ID can be downloaded

After invoking this method, the caller can do a regular HTTP GET on the returned URL to retrieve the report.

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$reportJobId - ID of the ReportJob
  4.  $response $reportService->getReportDownloadUrl($reportJobId);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response  - URL from which the report can be downloaded
  11.  ?>

string|false getReportDownloadUrl (int $reportJobId, [string $clientEmail = ''])
  • int $reportJobId: ID of the ReportJob
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Returns the status of the report job with the given reportJobId

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$reportJobId - ID of the ReportJob
  4.  $response $reportService->getReportJobStatus($reportJobId);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response  - The report job status
  11.  ?>

string|false getReportJobStatus (int $reportJobId, [string $clientEmail = ''])
  • int $reportJobId: ID of the ReportJob
  • string $clientEmail: provide the clientEmail when you want to edit a client's account rather than your own account

Schedules a report job for execution

Example:

  1.  <?php
  2.  $reportService->setAccount($myEmail$myPass$myUserAgent$myDeveloperToken$myApplicationToken);
  3.  //$reportJ is an object of class AdWordReportJob
  4.  $response $reportService->scheduleReportJob($reportJ);
  5.  if ($response === false// if an error appears
  6.          $errr $classKW->getLastError()//get error object
  7.          echo $errr->toString()//output error
  8.          exit();
  9.  }
  10.  //$response - a handle to the scheduled report job
  11.  ?>

int|false scheduleReportJob (object AdWordReportJob $job, [string $clientEmail = ''])

Inherited Methods

Inherited From AdWordService

 AdWordService::AdWordService()
 AdWordService::callService()
 AdWordService::getAccount()
 AdWordService::getClientCustomerId()
 AdWordService::getClientEmail()
 AdWordService::getLastError()
 AdWordService::getResponseHeaders()
 AdWordService::setAccount()
 AdWordService::setClientCustomerId()
 AdWordService::setClientEmail()

Documentation generated on Mon, 10 Sep 2007 15:07:25 +0300 by phpDocumentor 1.3.2