I'm doing a URL call in a API but I've got this error
TypeError: Cannot find function getContentText in object
Here is bellow my code. I even tried to encode the URL but still not working. Could you please tell me where I'm wrong ? And what is the fix ?
Thank you,
var url = 'https://welcome.de.coremetrics.com/analyticswebapp/api/1.0/report-data/explore/explore.ftlid=634022';
var params = {
'clientId': 'mi_id',
'format': 'JSON',
'userAuthKey' : 'my_key',
'language' : 'en_US',
'viewID' : 'default.ftl',
'period_a' : 'D20170601',
'fileName' : 'explore_explore^id=634022_default_view_D20170601.json'
}
var options = {
'method' : 'GET',
'payload' : params
};
response = UrlFetchApp.getRequest(url,options);
var data = JSON.parse(response.getContentText());
UrlFetchApp.getRequest(), there is nogetContentText(). You can directly seeresponse. So you can useLogger.log(response). If you want to dofetch, please changeUrlFetchApp.getRequest()toUrlFetchApp.fetch(). In the case ofUrlFetchApp.fetch(),getContentText()can be used for the response. The detail information is developers.google.com/apps-script/reference/url-fetch/…