# Post JSON object to InfluxDB

**URL:** https://discourse.nodered.org/t/post-json-object-to-influxdb/50759
**Category:** General
**Tags:** http-request
**Created:** [8 September 2021 12:42 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759 "2021-09-08T12:42:13Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![nisitpuk](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@nisitpuk](https://discourse.nodered.org/u/nisitpuk)
#### Post date: [8 September 2021 12:42 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759/1 "2021-09-08T12:42:13Z")

</div>

Hi, everyone I try to post the JSON data into influx but when I post it database by [http://localhost:8086/write?db=weathermap](http://localhost:8086/write?db=weathermap) it doesn't work. How can I fix this issue

 ![noderedJsontoInflux](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/39701d903d3538d78ccbf5e2384fd51ad10f6917.png)

```auto
[
    {
        "id": "82c273f1293e06ae",
        "type": "tab",
        "label": "Flow 6",
        "disabled": false,
        "info": ""
    },
    {
        "id": "ca3dd8686bec984b",
        "type": "http request",
        "z": "82c273f1293e06ae",
        "name": "http GET",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "credentials": {},
        "x": 140,
        "y": 300,
        "wires": [
            [
                "0372ae89187ebc26"
            ]
        ]
    },
    {
        "id": "c40f27e9377b4b66",
        "type": "debug",
        "z": "82c273f1293e06ae",
        "name": "LogPosttoDB",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 180,
        "wires": []
    },
    {
        "id": "bd51bb60b3fd81e4",
        "type": "inject",
        "z": "82c273f1293e06ae",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payloadType": "date",
        "x": 110,
        "y": 200,
        "wires": [
            [
                "ca3dd8686bec984b"
            ]
        ]
    },
    {
        "id": "b63dea331e7a0a70",
        "type": "http request",
        "z": "82c273f1293e06ae",
        "name": "http POST",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "http://localhost:8086/write?db=weathermap",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "credentials": {
            "user": "",
            "password": ""
        },
        "x": 450,
        "y": 240,
        "wires": [
            [
                "c40f27e9377b4b66"
            ]
        ]
    },
    {
        "id": "cc94f94035038243",
        "type": "debug",
        "z": "82c273f1293e06ae",
        "name": "LogJSON",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 420,
        "y": 400,
        "wires": []
    },
    {
        "id": "0372ae89187ebc26",
        "type": "json",
        "z": "82c273f1293e06ae",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": true,
        "x": 310,
        "y": 300,
        "wires": [
            [
                "cc94f94035038243",
                "b63dea331e7a0a70"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [8 September 2021 13:03 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759/2 "2021-09-08T13:03:13Z")

</div>

Welcome to the forum @nisitpuk.

Is there a reason that you are not using the influxdb nodes? [node-red-contrib-influxdb (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-influxdb)  
They work well and are well maintained.

---

<div class="post-metadata">

### Author: ![nisitpuk](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@nisitpuk](https://discourse.nodered.org/u/nisitpuk)
#### Post date: [8 September 2021 13:16 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759/3 "2021-09-08T13:16:29Z")

</div>

many thanks for a fast reply, @Colin I follow you in many topics. So I will be studying your suggestion and feedback you soon.

---

<div class="post-metadata">

### Author: ![nisitpuk](https://avatars.discourse-cdn.com/v4/letter/n/0ea827/32.png) [@nisitpuk](https://discourse.nodered.org/u/nisitpuk)
#### Post date: [8 September 2021 17:42 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759/4 "2021-09-08T17:42:51Z")

</div>

Again, Thank you @Colin for your suggestion. I can do it after I learn on this link [node-red-contrib-influxdb "[node-red-contrib-influxdb (node) - Node-RED](https://flows.nodered.org/node/node-red-contrib-influxdb)" it is very useful for me. Now I can post the JSON data get from OpenWeather Map API and post to influxDB. The latest flow is shown below.

```auto
[{"id":"82c273f1293e06ae","type":"tab","label":"Flow 6","disabled":false,"info":""},{"id":"ca3dd8686bec984b","type":"http request","z":"82c273f1293e06ae","name":"http GET","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://api.openweathermap.org/data/2.5/weather?q=Tambon Rangsit&appid=2275b2c49293037fed692057360e0a0a","tls":"","persist":false,"proxy":"","authType":"","x":140,"y":160,"wires":[["0372ae89187ebc26"]]},{"id":"c40f27e9377b4b66","type":"debug","z":"82c273f1293e06ae","name":"LogPosttoDB","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":490,"y":380,"wires":[]},{"id":"bd51bb60b3fd81e4","type":"inject","z":"82c273f1293e06ae","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"3600","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":150,"y":80,"wires":[["ca3dd8686bec984b"]]},{"id":"cc94f94035038243","type":"debug","z":"82c273f1293e06ae","name":"LogJSON","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":300,"y":240,"wires":[]},{"id":"0372ae89187ebc26","type":"json","z":"82c273f1293e06ae","name":"","property":"payload","action":"","pretty":true,"x":130,"y":240,"wires":[["40e3da509c4b5071","cc94f94035038243"]]},{"id":"40e3da509c4b5071","type":"function","z":"82c273f1293e06ae","name":"multiple measurement points","func":"msg.payload = [\n {\n measurement: \"location\",\n fields: {\n longtitude: msg.payload.coord.lon,\n latitude: msg.payload.coord.lat\n },\n tags:{\n type:\"location\"\n },\n },\n {\n measurement: \"weather\",\n fields: {\n temp: msg.payload.main.temp,\n temp_min: msg.payload.main.temp_min,\n temp_max: msg.payload.main.temp_max,\n pressure: msg.payload.main.pressure,\n humidity: msg.payload.main.humidity,\n sea_level: msg.payload.main.sea_level,\n grnd_level: msg.payload.main.grnd_level\n },\n tags:{\n type:\"weather\"\n },\n },\n {\n measurement: \"wind\",\n fields: {\n speed: msg.payload.wind.speed,\n deg: msg.payload.wind.deg,\n gust: msg.payload.wind.gust,\n },\n tags:{\n type:\"wind\"\n },\n },\n {\n measurement: \"rain\",\n fields: {\n Onehour: msg.payload.rain[\"1h\"]\n },\n tags:{\n type:\"rain\"\n },\n },\n {\n measurement: \"clouds\",\n fields: {\n all: msg.payload.clouds.all\n },\n tags:{\n type:\"rain\"\n },\n },\n \n]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":260,"y":320,"wires":[["c40f27e9377b4b66","d57e179a6de9bf6e"]]},{"id":"d57e179a6de9bf6e","type":"influxdb batch","z":"82c273f1293e06ae","influxdb":"6ca8bde.9eb2f44","precision":"","retentionPolicy":"","name":"","database":"weatherstation","precisionV18FluxV20":"ms","retentionPolicyV18Flux":"","org":"","bucket":"","x":540,"y":320,"wires":[]},{"id":"6ca8bde.9eb2f44","type":"influxdb","hostname":"localhost","port":"8086","protocol":"https","database":"new_db","name":"DBweatherstation","usetls":true,"tls":"f7f39f4e.896ae","influxdbVersion":"1.8-flux","url":"http://localhost:8086","rejectUnauthorized":false},{"id":"f7f39f4e.896ae","type":"tls-config","name":"local-tls","cert":"","key":"","ca":"","certname"![Flow|690x317](upload://tITnwNurdFhNEUEJz6VGQA9UOwj.png)
![payload|671x500](upload://gBg8tr01GpHdshtPlUElTqzExPk.png)
:"","keyname":"","caname":"","verifyservercert":false}]

```

 ![Flow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/0/d0522d9445ea05514110b4b7ed8ca8cb0d2709eb.png)  
 ![payload](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/7459082f3cd2158b4c7ebc4280d51ed6941e68e2.png)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [7 November 2021 17:43 UTC](https://discourse.nodered.org/t/post-json-object-to-influxdb/50759/5 "2021-11-07T17:43:28Z")

</div>

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