Hi, I am trying to access Google Ads API via Google Apps Script using the below code.
var ADWORDS_SCOPE = "https://www.googleapis.com/auth/adwords"; var REQUEST_TOKEN_URL="https://www.google.com/accounts/OAuthGetRequestToken"; var TOKEN_ACCESS_URL = "https://accounts.google.com/o/oauth2/token"; var AUTHORIZATION_URL = "https://accounts.google.com/o/oauth2/auth"; function getGoogleAdsOAuthService() { console.log("getGoogleAdsOAuthService"); return OAuth2.createService("googleads.googleapis.com") .setAuthorizationBaseUrl(AUTHORIZATION_URL) .setTokenUrl(TOKEN_ACCESS_URL) .setClientId(CLIENT_ID) .setClientSecret(CLIENT_SECRET) .setProjectKey(ScriptApp.getProjectKey()) .setCallbackFunction('authCallback') .setPropertyStore(PropertiesService.getUserProperties()) .setParam('access_type', 'offline') .setParam('approval_prompt', 'force') .setScope(ADWORDS_SCOPE) } function getReport(clientId, reportDefinition, skipReportHeader, skipColumnHeader, skipReportSummary) { var service = getGoogleAdsOAuthService(); //nsole.log(service); var options = { method: 'POST', muteHttpExceptions: true, Host : 'googleads.googleapis.com', headers: {'developer-token': DEVELOPER_TOKEN, 'login-customer-id': clientId, 'Authorization': 'Bearer ' + service.getAccessToken(), }, body: { 'query': reportDefinition, }, }; console.log("Options:"); console.log(options); var REPORT_URL = 'https://googleads.googleapis.com/v8/customers/'+clientId+'/googleAds:searchStream'; var res = UrlFetchApp.fetch(REPORT_URL, options); var output = []; console.log(res); return res; } here query is "SELECT campaign.id FROM campaign WHERE campaign.status = 'ENABLED' AND campaign.serving_status = 'SERVING'" This is resulting in UNEXPECTED_END_OF_QUERY. What am I missing ? Regards, Suchitra -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/69fe95e9-7a42-4572-8f5f-980628a8886en%40googlegroups.com.