Working curl request to HTTP Request Node

Hi all,

I have a working curl request I try to make work through an HTTP Request, but I can’t find the correct setup.

The curl request is :

curl --request PUT  'http://server.lan/api/core/ana/23456?ApiKey=myapikey' --data-raw '{ "value": 22}'

How would you setup the HTTP Request node with PUT to do the same ?

Thanks a lot for your help

Try it like this.

{
  "nodes": [
    {
      "parameters": {
        "requestMethod": "PUT",
        "url": "http://server.lan/api/core/ana/23456?ApiKey=myapikey",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "form-urlencoded"
        },
        "bodyParametersJson": "={{ { \"value\": 22} }}"
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1020,
        280
      ]
    }
  ],
  "connections": {}
}

i previously suggested there to be some function you can just paste curl requests and it automagically setups up the HTTP node correctly

Thanks @RicardoE105 , but it does not work. I got this error

{
"status": "rejected",
"reason": {
"message": "Request failed with status code 400",
"name": "Error",
"stack": "Error: Request failed with status code 400 at createError (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/createError.js:16:15) at settle (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/core/settle.js:17:12) at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/n8n/node_modules/axios/lib/adapters/http.js:269:11) at IncomingMessage.emit (events.js:327:22) at endReadableNT (internal/streams/readable.js:1327:12) at processTicksAndRejections (internal/process/task_queues.js:80:21)"
}
}

@RedPacketSec I totally agree with your idea. It’s a bit tricky to transpose curl request that I get as example in Postam to N8N object.

@RedPacketSec ahh yes, that would be amazing. We have talked about it internally. I guess at some point it is going to make it to the roadmap.

@mcc37 I used postman to map the curl request to the request library, which n8n “uses” behind the scenes. Do you have the docs of his API so that I can have a look at it and might spot the issue?

Hi @RicardoE105 , you can fin the API Deck here :

Or you can also go there to browse through the API :