function zTestAPIJSONPayload(){
// Make a POST request with a JSON payload.
var formData = {"input1":"goes here", "input2":"56"};
var options =
{
"method" : "post",
"contentType" : "application/json",
// this also works fine as an alternative format "payload" : '{ "input1": "hereis the first input", "input2": " here is the second input"}'
"payload" : JSON.stringify(formData) //doing this JSON.stringify conversion is ESSENTIAL or the Zoho CRM function doesn't recognise the input as JSON
};
try{
var response = UrlFetchApp.fetch('https://www.zohoapis.com/crm/v2/functions/[FUNCTION NAME HERE]/actions/execute?auth_type=apikey&zapikey=1003[KEY HERE]', options);
contentText = response.getContentText();
console.log("contentText: " + contentText);
}
catch(e)
{
console.log("Error is " + e);
}
}