Merging Data with Multiple API calls

Many times you may want to run a few API calls and then combine the data.

This flow illustrates two ways to accomplish this.

flow.json

Option 1

Use a function node to loop through each item of the response array and assign additional properties from our state.

The function uses the JavaScript map method to loop through each item in the resposne array and assign the properties for the given admiId in this example.

Option 2

Use a pair of split/join nodes to handle the loop for us, and use a simpler function node to copy the extra info to the msg object.

The function node will now only focus on assigning extra data to the msg object.