I want to send some data from my server to zapier which is requested by the zapier. What to send in response if my server does not have that data. It should be empty array response or some error message
if(contact?.length){
const contactClone = _.clone(contact);
_.filter(contactClone, function(o: any) { return o.tag_updated_on; }); // if some specific contact has this field which should be rerturned
_.orderBy(contactClone, 'tag_updated_on', 'desc');
if(contactClone?.length){
res.status(200).json([contactClone[0]]); ////First one contact from the array would be returned
return;
}
res.status(200).json([contact[0]]); //What should be returned here
should be empty array response or some error message
Either of these would be appropriate, depending on how you want the caller to respond. A 404 response would be fine if you want it to error. A []
or {}
could make sense too, if the caller is expecting to handle it.