I started using Coda API/Webhooks recently so I am kinda new to this.
I understand that if you send a key:value pair JSON format to automation listening to webhook (for example { “name”: “Jhon”, “surname”: “Smtih”} you can than reference that data in Step1 results and do with it what you need to do.
But is it possible for Webhook to receive array of objects ( [{}, {}, {}] ) and then use .forEach on Step1 result to loop over them and do what you need or Webhook is limited to only 1 object?
I already tried that but was getting some errors, so not sure if its a problem with structure or you just have to send a “single” object to Webhook only
yes you can.
if you send properly formed JSON containing an array.
but the array must not be the top element.
eg
{“myArray”:[111,222,333]}
should be ok
max
1 Like
Hey @Xyzor_Max , thanks for quick answer.
I missed that trick, thanks! I thought endpoint will be able to receive array of objects “natively”
I was getting info from other service in this format and it wouldn’t go
[
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
]
So the trick is to “wrap-it” up with key to contains array, that works!
{ “Data” :
[
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
{ id: ‘10’, ident: ‘Codatest’, price: ‘91’ }
]
}
Now only to figure out how to make rows of that nested array 
1 Like