Error: Missing report definition

544 views
Skip to first unread message

Jeff Siebach

unread,
Jun 8, 2014, 12:34:35 PM6/8/14
to adwor...@googlegroups.com
Hello,

I am trying to query the AdWords reporting API using the following Google Scripts code:

  var params = {
    headers: {
    Authorization: 'Bearer ___ACCESS_TOKEN___',
    developerToken: '___DEVELOPER_TOKEN___',
    clientCustomerId: '___CUSTOMER_ID_XXXXXXXXXX___'
          },
    muteHttpExceptions: true,
    '__rdquery' : 'SELECT CampaignName FROM CAMPAIGN_PERFORMANCE_REPORT DURING LAST_7_DAYS',
    '__fmt' : 'CSV',
    method:'post'
  }
  Logger.log(params)
  Logger.log(UrlFetchApp.fetch(url, params))
}

The response I get is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>ReportDownloadError.MISSING_PARAMETER</type><trigger>Missing report definition</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>

I have tried defining the reports in a number of different ways:

With and without + between the words of __rdquery, as it is shown here: https://groups.google.com/forum/#!msg/adwords-api/TzvGZxsTIOg/gdhT8WZIg7YJ
I have tried with and without URL encoding for the __rdquery and for the authorization token.

Could this be an error with my authorization?  Or am I failing to define my request correctly?  

I could not find a client library with any existing code that works in Google Scripts.  If there is a resource I could review for accessing the AdWords API using the UrlFetchApp I would be really appreciative.

Thank you

Josh Radcliff (AdWords API Team)

unread,
Jun 9, 2014, 4:38:40 PM6/9/14
to adwor...@googlegroups.com
Hi,

I'm not a Google Apps Script expert, but it seems that you aren't placing your request parameters under the payload parameter as shown in the Advanced parameters table under fetch(String,Object).

Cheers,
Josh, AdWords API Team

Pierre Rudolfsson

unread,
Sep 8, 2016, 9:40:39 AM9/8/16
to AdWords API Forum

This is an old question, but I'm having the same issue.

I am trying to access the Adword API from google apps script and I get the same missing report definition error as above. I believe that the error is in the structure of the request. This is the code I use:

  var request = {
    method: "POST",
    muteHttpExceptions: true,
    headers : {
      Authorization: 'Bearer ' + ACCESS_TOKEN,
      developerToken: DEVELOPER_TOKEN,
      clientCustomerId: CLIENT_CUSTOMER_ID},
    payload : {'__fmt': 'CSV', '__rdquery': 'SELECT CampaignName FROM CAMPAIGN_PERFORMANCE_REPORT DURING LAST_7_DAYS'},
    contentType: 'multipart/form-data; boundary=------------------------12d01fae60c7b559'
    }

 
    var txtReq = UrlFetchApp.getRequest(urlEndPoint, request)
  Logger.log(txtReq)
  var response = UrlFetchApp.fetch(urlEndPoint, request)
  Logger.log(response)


Josh Radcliff (AdWords API Team)

unread,
Sep 8, 2016, 1:58:35 PM9/8/16
to AdWords API Forum
Hi,

Have you considered using AdWords Scripts instead? That would give you a more robust interface for running reports (e.g., see the Create a text report example).

Thanks,
Josh, AdWords API Team

Pierre Rudolfsson

unread,
Sep 9, 2016, 5:05:04 AM9/9/16
to AdWords API Forum
Hi Josh,

Thank you for your quick feedback. Sorry, I was not providing the scope of the question. 

I wish to get access to the full API (i.e., not only reporting, and specifically features like the DataService that are not accessible through AdWords scripts) from GAS, in the same way I access it through the client libraries (Python in this case).

I merely thought that starting with the simplest use case of fetching a report would tell me how to get general access.

Thank you

Pierre

Josh Radcliff (AdWords API Team)

unread,
Sep 9, 2016, 9:55:32 AM9/9/16
to AdWords API Forum
Hi Pierre,

I'm not sure if this will work, but maybe try setting contentType application/x-www-form-urlencoded?

Thanks,
Josh, AdWords API Team

Pierre Rudolfsson

unread,
Sep 13, 2016, 5:59:33 AM9/13/16
to AdWords API Forum
Hi Josh,

Thank you very much, that did the trick! At least I now get an authentication error suggesting that the structure of the query is correct.

//Pierre
Reply all
Reply to author
Forward
0 new messages