javascript - Zapier Reformatting a Get Fetch Response -


i having issues zapier , fetching information.

what trying fetch url, receive json response , send entire response next step additional processing.

zapier seems ignoring callback or other code wrote , sending 'zapier formatted' response next step, not in json format. below code samples:

request client

var authheaders = {     'authorization': 'bearer xxxx',     'content-type': 'application/json' } var options = {   method: 'get',   headers: authheaders };  fetch('www.url.com', options)   .then(function(res) {     return res.json();   })   .then(function (json) {     callback(null, json)   })   .catch(callback); 

zapier next step option in dropdown:

input.name === harry,bob,sally input.color === red, blue, green 

response client

{   cats: [     {name: 'harry', color: 'red'},     {name: 'bob, color: 'blue''},     {name: 'sally', color: 'green'},     {name: 'mary', color: 'green'},     {name: 'george', color: 'green'}   ] }  

what want in next zapier step clients response , not zapier interpretation can normal looping , parsing of json object.

cats.filter(function(cat){   return cat.color === 'green' }) 

i want cats green returned next step. how can this, if cat attributes in different zapier fields?

another thing tried reformat zapier next step response after make get request zapier doesn't listen me.

fetch('www.url.com', options)   .then(function(res) {     callback(null, {dog: 'yorkie'})   })   .catch(callback); 

the above code should send object passing on, {dog: 'yorkie'} returns same 'zapier formatted cat response'.

furthermore, when didn't follow zapier callback format , put in fetch request, sent 'zapier formatted cat response' next step.

fetch('www.url.com', options) 

you'll want filtering in js step , emit records care instead of emitting records , making new steps filter them.

fetch('www.url.com', options)     .then(function(res) {         return res.json();     })     .then(function (json) {         json = json.filter(record => record.color === 'green');         callback(null, json);     })     .catch(callback); 

if objects nested lists - can difficult them raw js object format in follow steps - best bet return object no nested arrays.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -