Unfortunately there is no way to run reports through the API without
using the ReportService.scheduleReportJob() method. Because
misconfigured reports are still charged at full price it is wise to
run ReportService.validateReportJob() first to ensure it is a valid
report. There is no way to avoid spending these API units.
Best,
- Eric Koleda, AdWords API Team
On Jan 25, 8:37 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:
$email = "MCC a/c email";
$password = "MCC a/c pwd";
$useragent = "Ipsita Test Sample";
$applicationToken = "app token";//Ignored in Sandbox
$account_type = "GOOGLE";
$service = "adwords";
$clientEmail = "$email";
$namespace = 'https://adwords.google.com/api/adwords/v13';
$developerToken = 'dev token';
$clientEmails =
array("array of emails get through
$account_service = SoapClientFactory::GetClient($namespace . '/
AccountService?wsdl', 'wsdl');
$account_service->setHeaders($headers);
$debug = 0;
//$login_emails = $account_service->call('getClientAccounts');
//$login_emails = $login_emails['getClientAccountsReturn'];
$login_emails = $account_service->call('getClientAccountInfos');
$login_emails = $login_emails['getClientAccountInfosReturn'];
");
$clientEmailsXml = '';
foreach($clientEmails as $clientEmail) {
$clientEmailsXml .=
"<clientEmails>" . trim($clientEmail) . "</clientEmails>";
}
# Define SOAP headers.
$headers =
'<email>'.$email.'</email>'.
'<password>'.$password.'</password>'.
'<useragent>'.$useragent.'</useragent>'.
'<developerToken>'.$developerToken.'</developerToken>'.
'<applicationToken>'.$applicationToken.'</applicationToken>';
$report_service = SoapClientFactory::GetClient($namespace . '/
ReportService?wsdl', 'wsdl');
$report_service->setHeaders($headers);
$report_job =
'<selectedReportType>Campaign</selectedReportType>'.
'<name>Sample Keyword Report</name>'.
'<crossClient>true</crossClient>'.
$clientEmailsXml.
'<aggregationTypes>Daily</aggregationTypes>'.
'<adWordsType>ContentOnly</adWordsType>'.
'<keywordType>Broad</keywordType>'.
'<startDay>2004-06-20</startDay>'.
'<endDay>2037-12-30</endDay>'.
'<selectedColumns>Impressions</selectedColumns>'.
'<selectedColumns>Clicks</selectedColumns>'.
'<selectedColumns>CTR</selectedColumns>'.
'<selectedColumns>CPC</selectedColumns>';
$request_xml =
'<validateReportJob>'.
'<job xmlns:impl="https://adwords.google.com/api/adwords/v13" '.
'xsi:type="impl:DefinedReportJob">'.$report_job.'</job>'.
'</validateReportJob>';
# Validate report.
$report_service->call('validateReportJob', $request_xml);
print '<pre>';print_r($report_service);exit;
In the response array one statement i got
[document] =>
soapenv:Server.userException
One or more report job parameters is invalid.
30
One or more report job parameters is invalid.
The following columns are not supported by the Report Type
Campaign : [KeywordTypeDisplay]
When I changed $clientEmailsXml. to
'<clientEmails></clientEmails>'.
in the above code I got
[document] =>
soapenv:Server.userException
Either this object does not exist, or this user does not have
permission to access it.
4
Either this object does not exist, or this user does not have
permission to access it.
Can u plz tell me where I am wrong?
Can you explain what you are trying to accomplish with this code?
What are your goals, and what is failing?
Best,
- Eric
On Jan 26, 8:20 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
Only certain types report multiple aggregation types, but those are
used to drill down and limit the results, not include multiple kinds
of data. For example, the Search Query Performance Report uses two
aggregation values ("Account, Daily", "Campaign, Weekly", etc):
http://code.google.com/apis/adwords/docs/developer/adwords_api_report_query.html
Unless the aggregations are listed with commas then only one
aggregation is support per report job.
Best,
- Eric Koleda, AdWords API Team