Trying to get data from a trigger *through* an http request

I’m trying to take multiple inputs which I merge together and push them through an http request. The example here works, it’s address and login information on 2 hosts (I have dozens but 2 is good for an example). The flow before works, however I can’t find a clean way to get the source data into the output. ie, I want a column in the output data showing which source data was used for the query. Here, the output data processes all of the data from the merge properly, but the output has no indication which of host1 or host2 was used. I’m just trying to glue in the data from host1 or 2 into the output.

Down the chain I’ll use this data to trigger posts to change it. This is the read step so I can analyse what to do.

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

This is on n8n cloud by the way.

@syadnom , it sounds like what you are looking for is how to reference the output of the previous nodes other than immediately preceding the current one. You can follow Output of other nodes for that.

I’m trying this, creating a node code node after the http get and adding the following js.

for (const item of $input.all()) {
item.json.myNewField2 = $(“MergeCredentials”).all();
return $input.all();

I did all() just to see the results. This does pull the details from the ‘MedgeCredentials’ which is the merge node directly before the http but it doesn’t show anything to identify which output matches which input. ie, there’s no ‘index0/1/2/3’ etc to match it to.

@syadnom , another thing you need to learn is the structure of n8n data. Please, refer to Data structure.

Having said that, what you are trying to do can be achieved with no-code by means of Merge node. Visually, it will looks like this.

unfortunately the merge by position just pairs index 0 to 0 and 1 to 1 and so on for the two inputs. It doesn’t match input 1 http request into an output column that says ‘this is from input 1’ and input 2’s http request with a ‘this is from input 2’. I can’t get that to work in any merge mode I’ve tested, if I could get that I could do an additional merge to mix back in the data with a matching field.

In this scenario, the first merge (which is an append from previous data) > ‘get data’ runs 2 separate http lookups which works and the output there lines up properly. The merge by position that follow matching line 1 from merge3 and line 1 from get data, then line 2 from merge3 and line 2 from get data which is a mismatch.

If I look at the output from the get data http query, in json/schema/table etc there is no index data there at all. I can’t find anything to include that so even if I use a node afterwards I dont have an index.

Now, I can just run separate nodes for all of this BUT the goal here is to actually store the data for the query externally in a table. Grab the table rows and execute the http lookup, so breaking this out into a bunch of nodes is not ideal at all.

merge/append (pass a column through ) → get data → outputdata (add column from the merge/append that lines up to input).

a different way to say it.
merge says ‘http, run with this router name, user, and password, then output all the data and include the router name in that data’