Send full array via HTTP

Describe the problem/error/question

New to n8n, I feel like I must be missing something. I have a basic array. I need to POST that array, in full. Any way I try, it ends up POSTing every item individually. I just want to take the array generated from the GenData step and set it as the HTTP body. The input fields are draggable, but not the entire input step. I’ve found some references to similar issues, but not quite the same, and the solutions involved writing custom JS… Seem way overkill for something so seemingly simplistic.

What is the error message (if any)?

Please share your workflow

Not sure how to share it without showing sensitive info.  Pertinent node:

Share the output returned by the last node

Information on your n8n setup

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

set the body content type to JSON in the HTTP node, then in the body field use the expression tab and reference {{$node.GenData.json}} directly. thats what sends the whole array as-is instead of iterating through each item. the drag-and-drop from the input panel only maps individual fields, not the parent object

Hi @flowdan have you tried using the aggregate node before the HTTP request?

Same thing using that expression

I have not. I’ve got my full array ready to go, doesn’t make sense to need another step there, unless that’s just a weird n8n thing.

1 Like

Hi @flowdan According to the principle of data pass down in n8n, each ITEM which in your case might be (10-12) will be treated differently (1 item → 1 run, each item will make the second node run each time) as it says it is an ARRAY of items, what aggregate node will do is that it would combine all the different items into a single item, i dont know the request you are tryna make in HTTP but aggregate node is what we use to aggregate a list of items into a single item without compromising the data.

3 Likes

Ok, that’s the key piece of info there. On other platforms I’m used to just slapping the generated json body in as the input for whatever and we’re off. So there’s just no way to address an entire array as a single item for the purpose of passing the entire thing, it’s gotta be wrapped up into an object. Easy enough.

Thank you

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.