I'm trying to make a Zap that POST data to my API and after doing stuff on my side, my API returns a HTTP200 status code. Everything works on my side, but Zapier keep returning a "You must return a single object or array of objects" error. Is there something wrong with my code (Zapier side)?
Here it is :
if(inputData.Status === "Accepted"){
var data = {
TypeTemplate: 1,
Date: inputData.Date,
DocteurExterneID: inputData.DocteurExterneID,
NomDuDocteur: inputData.NomDuDocteur,
NomDuClient: inputData.NomDuClient,
CourrielClient: inputData.CourrielClient,
Prix: inputData.Prix
};
fetch('http://myapiurl/Zapier/', {
method: 'POST',
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}).then(function (res) {
return {result:true};
}).catch(function(error) {
callback(error);
});
}
you have to change the following line :
return {result:true};
to
callback(null, res.text());