Google Apps Script interaction with Zoho API
I am experimenting with extracting certain data --Leads, Vendors, ...-- from Zoho CRM. Based on their API description I have created a function that creates a ticket and I have an issue with the next function that should obtain the data from Zoho.
I have added two Logger.log lines to visualize certain variables.
When I copy the zohoVendorUrl into a browser window I get to see the JSON data. When I run the script, the script shows null for the var o in the log.
When I read result.getResponseCode, the code is "200", which indicates the client sent a successful request.
Any suggestions on the "null" issue here?
// Get vendors from ZOHO CRM
function getVendors() {
ticket = getZohoTicket();
var zohoApiKey = "
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //changed
var zohoVendorUrl = "https://crm.zoho.com/crm/
private/json/Leads/getRecords?&ticket=" + ticket +"&apikey=" + zohoApiKey + "&newFormat=1&selectColumns=All";
var result = UrlFetchApp.fetch(
zohoVendorUrl);
var o = Utilities.jsonParse(result.
getContentText());
Logger.log(o);
}
PS If I switch to http I am getting an Java exception error in GAS that it cannot open the URL.