I need to fetch a id from a http tool response and send it to another http tool

Hi, I need help, I have a chatbot where two http tool is connected, I called first http and got json response. Now I need to fetch a id from that response and send it to another http tool. How can I do it? Is it possible?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

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

Hi @Jannatul_Ferdous,
Welcome

Yes, totally possible, and it’s a super common n8n pattern.

You just take the ID returned by your first HTTP Request node and referrence it in the second one using an expression. In n8n you can pull data from any previous node like:

{{ $(‘First HTTP Node Name’).item.json.id }} or if it’s nested: {{ $(‘First HTTP Node Name’).item.json.data.id }}

How to do it quickly:

Run the workflow once and open the Execution data for your first HTTP node. Find exactly where the ID lives (e.g. id, data.id, results[0].id, etc.). In your second HTTP node, click the field where you need the ID (URL / params / body), switch it to Expression, and reference it.

Example: {{ $(‘First HTTP’).item.json.id }}

If it’s inside an array: {{ $(‘First HTTP’).item.json.results[0].id }}

If you paste the JSON structure from the first HTTP response (even just a small sample), I can tell you the exact expression path to use.

3 Likes

Thanks a millions. It worked.

1 Like

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