HTTP Request Node URL parameter

Hi, I’m trying to configure the n8n HTTP Request Node to do a GET request like this https://hostname.api.test.com/api/Elements?LastSeen={LastSeen}. How I can indicated the URI parameter {LastSeen}? Thank

Hey @backherozzo,

In theory all you need to do is…

So you would add a parameter to the bottom with the name you are after and set the value to whatever you want, It can even be something from a previous node in your workflow.

3 Likes

Hi, thank you for your quick reply I’ve done several tests and can’t find a way to pass it as a URL parameter. If I make the URL request by putting the parameter directly in the n8n field URL: (example https://hostname.api.test.com/api/Elements?LastSeen=2021-11-02) on this case works but I need to manage the LasSeen dynamically because this will be an update date request every 10 minuts. I tried to insert in the n8n URL: field https://hostname.api.test.com/api/Elements?LastSeen={LastSeen} and on the Query Parameter the LastSeen (2021-11-02) and value but it does not work. Do you have any suggestions for me?

You can do this with n8n expressions - specifically, an expression set on the HTTP Request’s “URL” parameter. See this workflow example below:

In the example, the “Set” node is simply a placeholder to show how you’d use data from previous node within the HTTP Request

{
  "nodes": [
    {
      "parameters": {},
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "lastSeen",
              "value": "a-dynamic-value"
            }
          ]
        },
        "options": {}
      },
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "url": "=https://hostname.api.test.com/api/Elements?LastSeen={{$json[\"lastSeen\"]}}",
        "options": {}
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Set",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
1 Like