Hi All,
I suspect I'm missing something minor here, but when I create a report
using the service, no data is returned. However, when I log in to My
Client Center and "create similar report" it returns loads of the
data. Can anyone point out where I'm going wrong?
AccountService AccountService = new AccountService();
AccountService.emailValue = new
PlatformConnectors.Google.Adwords1.email();
AccountService.emailValue.Text = new String[]
{ Settings.Default.AdwordsUsername };
AccountService.passwordValue = new
PlatformConnectors.Google.Adwords1.password();
AccountService.passwordValue.Text = new String[]
{ Settings.Default.AdwordsPassword };
AccountService.useragentValue = new
PlatformConnectors.Google.Adwords1.useragent();
AccountService.useragentValue.Text = new String[] { "PPC Tracking
system. V0.01 (Alpha 2)" };
AccountService.developerTokenValue = new
PlatformConnectors.Google.Adwords1.developerToken();
AccountService.developerTokenValue.Text = new String[]
{ Settings.Default.DeveloperToken };
AccountService.applicationTokenValue = new
PlatformConnectors.Google.Adwords1.applicationToken();
AccountService.applicationTokenValue.Text = new String[]
{ Settings.Default.ApplicationToken };
string[] Accounts = AccountService.getClientAccounts();
ReportService Service = new ReportService();
Service.emailValue = new email();
Service.emailValue.Text = new String[]
{ Settings.Default.AdwordsUsername };
Service.passwordValue = new password();
Service.passwordValue.Text = new String[]
{ Settings.Default.AdwordsPassword };
Service.useragentValue = new useragent();
Service.useragentValue.Text = new String[] { "Tracking system. V0.01
(Alpha 2)" };
Service.developerTokenValue = new developerToken();
Service.developerTokenValue.Text = new String[]
{ Settings.Default.DeveloperToken };
Service.applicationTokenValue = new applicationToken();
Service.applicationTokenValue.Text = new String[]
{ Settings.Default.ApplicationToken };
DefinedReportJob Job = new DefinedReportJob();
Job.name = "Automated Job";
Job.selectedReportType =
ReportTypes.PlacementAndKeywordPerformance; //"Keyword"
Job.startDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month,
DateTime.Now.Day).AddDays(-1);
Job.endDay = Job.startDay;
Job.aggregationTypes = new string[] { AggregationTypes.Summary };
Job.clientEmails = Accounts;
Job.crossClient = true;
Job.selectedColumns = new string[] {
ReportColumns.Keyword.Name,
ReportColumns.Clicks.Name }; //"Keyword", "Clicks"
Job.adGroupStatuses = new AdGroupStatus[] { AdGroupStatus.Enabled,
AdGroupStatus.Paused };
Job.campaignStatuses = new CampaignStatus[] { CampaignStatus.Active,
CampaignStatus.Paused };
Job.keywordStatuses = new KeywordStatus[] { KeywordStatus.Active,
KeywordStatus.Paused };
Service.validateReportJob(Job);
long JobId = Service.scheduleReportJob(Job);
...
The response is:
<?xml version="1.0" standalone="yes" ?>
- <report>
- <table>
- <columns>
<column name="keyword" />
<column name="clicks" />
</columns>
<rows />
</table>
- <totals>
<grandtotal clicks="0" />
</totals>
</report>