I'm trying to connect a Google spreadsheet via API GET request to receive some information from snov.io, but I am getting a HTML result instead of a JSON. The below Python code works, but the Google Appscript not. Any suggestions? Thank you :)
Python code - Working
params = {
'access_token': token,
'domain': site,
'type': 'all',
'limit': 100,
'lastId': 0,
}
res = requests.get('https://api.snov.io/v2/domain-emails-with-info', params=params)
return json.loads(res.text)
AppScript - not working - received HTML result
'access_token': token,
'domain': site,
'type': 'all',
'limit': 100,
'lastId': 0,
}
var url = 'https://api.snov.io/v2/domain-emails-with-info'
var response = UrlFetchApp.fetch(url, {method: "get", payload: params, 'muteHttpExceptions': true});
var json = response.getContentText()
console.log(response.getContentText())
obj = JSON.parse(json)
result=obj.emails
return result
}
HTML Result :(
<html>
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow" />
<style> body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; }
.container { margin: 30px; max-width: 600px; }
h1 { color: #dc3545; font-size: 24px; }</style>
</head>
<body>
<div class="container">
<h1>Whoops, looks like something went wrong.</h1>
</div>
</body>
</html>