Send RAW body with HTTP request

Hello everyone,
I’m trying to send some results to InfluxDB, since there is no node available for it I tried using the HTTP API. It’s fairly simple from the command line but I can’t make it work with n8n.

The following is how you will do it using CURL:

curl -X "POST" "http://influx...." \
     -H 'Content-Type: text/plain; charset=utf-8' \
     -d "cpu_load_short,host=server02 value=0.67"

My understanding is that body parameters in the HTTP Request accepts only pairs of key/value and it’s not possible to send RAW data, right? Is there any way I can send just a string like "cpu_load_short,host=server02 value=0.67"?

Welcome to the community @ABeltramo!

You can do what you want like this:

{
  "nodes": [
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "raw",
          "bodyContentCustomMimeType": "text/plain"
        },
        "bodyParametersJson": "cpu_load_short,host=server02 value=0.67",
        "headerParametersJson": "={{JSON.parse('{\"charset\": \"utf-8\"}')}}"
      },
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        754,
        353
      ]
    }
  ],
  "connections": {}
}

Thanks for the fast reply! You should edit it and remove the endpoint url.
This works perfectly, if I’ll find the time I’ll try to convert it to a proper node and make a pull request.

Great to hear that it works!

Ah actually left the URL in there on purpose as it was one from
https://requestbin.com
which is great for testing. But removed it now if you think it is confusing people.