Bad Request Error

360 views
Skip to first unread message

Eberle Communications

unread,
Jan 12, 2015, 1:50:14 PM1/12/15
to adwor...@googlegroups.com, ja...@beidleman.com
I am trying to use the sample to pull back a report.
I am getting this error information:

Google.Api.Ads.AdWords.Util.Reports.AdWordsReportsException was caught
  HResult=-2146233088
  Message=Report download errors occurred.
  Source=Google.AdWords
  StackTrace:
       at Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadReport(String downloadUrl, String postBody)
       at Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.GetReport()
       at Google.Api.Ads.Common.Util.Reports.AdsReportUtilities.GetResponse()
       at Google.Api.Ads.AdWords.Examples.VB.v201409.DownloadCriteriaReport.Run(AdWordsUser user, String fileName) in E:\Development\Google\NewSample\examples\AdWords\vb\v201409\Reporting\DownloadCriteriaReport.vb:line 91
  InnerException: System.Net.WebException
       HResult=-2146233079
       Message=The remote server returned an error: (400) Bad Request.
       Source=System
       StackTrace:
            at System.Net.HttpWebRequest.GetResponse()
            at Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadReport(String downloadUrl, String postBody)
       InnerException:




Not much to go on. Here is my code(should look familiar it is right from the Google Samples):

Dim definition As New ReportDefinition

definition.reportName = "CRITERIA_PERFORMANCE_REPORT ECG"

definition.reportType = ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT 'CRITERIA_PERFORMANCE_REPORT 'CAMPAIGN_PERFORMANCE_REPORT

definition.downloadFormat = DownloadFormat.GZIPPED_CSV

definition.dateRangeType = ReportDefinitionDateRangeType.LAST_7_DAYS

 

' Create the selector.

Dim selector As New Selector

selector.fields = New String() {"CampaignId", "AdGroupId", "Id", "CriteriaType", "Criteria", _

"CriteriaDestinationUrl", "Clicks", "Impressions", "Cost"}

Dim predicate As New Predicate

predicate.field = "Status"

predicate.operator = PredicateOperator.IN

predicate.values = New String() {"ACTIVE", "PAUSED"}

selector.predicates = New Predicate() {predicate}

definition.selector = selector

definition.includeZeroImpressions = True

 

Dim filePath As String = ExampleUtilities.GetHomeDir() & Path.DirectorySeparatorChar & fileName

Try

Dim utilities As New ReportUtilities(user, "v201409", definition)

utilities.GetResponse().Save(filePath)

Console.WriteLine("Report was downloaded to '{0}'.", filePath)

Catch ex As Exception

Throw New System.ApplicationException("Failed to download report.", ex)

End Try



Thanks In Advance


Josh Radcliff (AdWords API Team)

unread,
Jan 12, 2015, 4:11:50 PM1/12/15
to adwor...@googlegroups.com, ja...@beidleman.com
Hi,

If you inspect the AdWordsReportsException (e.g., by adding a breakpoint where it's being thrown), I think you'll see that the request is being rejected because the valid Status enums are ENABLED, PAUSED, or REMOVED, and you specified ACTIVE in your request.

Cheers,
Josh, AdWords API Team
Reply all
Reply to author
Forward
0 new messages