I am using search in Zapier. I have my own API which sends a single object when I search item by its item Id.
Below is response from API
{
"exists": true,
"data": {
"creationDate": "2019-05-23T10:11:18.514Z",
"Type": "Test",
"status": 1,
"Id": "456gf934a8aefdcab2eadfd22861",
"value": "Test"
}
}
when i search this by zap
Results must be an array, got: object, ({"exists":true,"data":{"creationDate":"2019-05-23T10:11:18.514Z)
Below is the code
module.exports = {
key: 'item',
noun: 'itemexists',
display: {
label: 'Find an item',
description: 'check if item exist'
},
operation: {.
inputFields: [
{
key: 'itemid',
type: 'string',
label: 'itemid',
helpText: 'Eg. e3f1a92f72c901ffc942'
}
],
perform: (z, bundle) => {
const url = 'http://IP:8081/v1/itemexists/';
const options = {
params: {
itemId: bundle.inputData.itemid
}
};
return z.request(url, options)
.then(response => JSON.parse(response.content));
},
sample: {
"exists": true,
"data": {
"creationDate": "2019-05-23T10:11:18.514Z",
"Type": "Test",
"status": 1,
"Id": "456gf934a8aefdcab2eadfd22861",
"value": "Test"
}
},
}
};