Using Zapier’s search, my API returns an object, not the expected array.
module.exports = {
key: 'item_lookup',
noun: 'Item',
display: {
label: 'Lookup an Item',
description: 'Check if an item exists.'
},
operation: {
inputFields: [{ key: 'itemID', type: 'string', label: 'Item ID', helpText: 'Eg. abc123xyz456' }],
perform: (zap, data) => {
const endpoint = 'http://example.com/api/lookup/';
const config = {
params: { id: data.inputData.itemID }
};
return zap.request(endpoint, config).then(res => JSON.parse(res.content));
},
sample: {
check: true,
details: {
date: '2020-01-01T00:00:00Z',
category: 'Example',
state: 1,
code: 'abc123xyz456',
name: 'Sample Item'
}
}
}
};