# Writing HTTP request values to InfluxDB

**URL:** <https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074>\
**Category:** General\
**Created:** [13 May 2019 14:33 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074 "2019-05-13T14:33:21Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![moebius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/moebius/32/2872_2.png) [@moebius](https://discourse.nodered.org/u/moebius)\
**Post date:** [16 May 2019 14:54 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/21 "2019-05-16T14:54:04Z")

</div>

@HaVi  
Julian already told you to look into the influxdb log - you can see there in detail whats going on (if not, you have to adjust the log level in the config).

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [16 May 2019 15:24 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/22 "2019-05-16T15:24:21Z")

</div>

Thanks Walter, I know Julian asked for it but I cannot locate any logfile on my RPi installation. After spending many frustrating hours, I have to conclude that my knowledge of this matter falls short to continue with this project so I quit.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 May 2019 20:07 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/23 "2019-05-17T20:07:21Z")

</div>

Hey, not so quick! 😄

```auto
sudo journalctl -u influxdb -e -f -n 50

```

Will show you your InfluxDB logs assuming you installed in in a normal way.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2019 08:14 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/24 "2019-05-18T08:14:09Z")

</div>

Thanks Julian and after taking a deep breath...

Below my flow so far, the output (value 6.03) in the debug is correct. As far as I know I have to write a measurement to the database and I suppose I need to do some conversion: value -\> measurement. If it can be done right from the http-request node that would be nice. The database should contain only the InfuxDB generated timestamp and the value from the flow. This should not be rocket science for many others but for me it is 😉

With your help I can now show the InfluxDB log but I think we don't need it as long as the flow generates the reported error. Am I right? Otherwise I can publish it here.

 ![julian](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/74bf629614b817a3e85875714cf64e0ed4c57ab9.png)

```auto
[{"id":"810b338d.3f2a9","type":"tab","label":"Julian","disabled":false,"info":""},{"id":"3d4ce47e.b06a9c","type":"debug","z":"810b338d.3f2a9","name":"Output Rhenen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"rhenen","x":900,"y":60,"wires":[]},{"id":"d416eed8.029a3","type":"inject","z":"810b338d.3f2a9","name":"240'","topic":"","payload":"","payloadType":"date","repeat":"14400","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":100,"wires":[["f685ec3f.c89e2"]]},{"id":"f685ec3f.c89e2","type":"http request","z":"810b338d.3f2a9","name":"HTTP Request Rhenen","method":"GET","ret":"obj","url":"https://waterinfo.rws.nl/api/detail?expertParameter=Waterhoogte ___20Oppervlaktewater___ 20t.o.v. ___20Normaal___ 20Amsterdams ___20Peil___ 20in___20cm&locationSlug=Grebbe%28GREB%29&user=publiek","tls":"","x":430,"y":100,"wires":[["e9a1c396.7bfe5"]]},{"id":"e9a1c396.7bfe5","type":"function","z":"810b338d.3f2a9","name":"Function Rhenen","func":"msg.rhenen = Number(msg.payload.latest.data)/100;\nreturn msg;","outputs":1,"noerr":0,"x":670,"y":100,"wires":[["3d4ce47e.b06a9c","b2e942c4.d7e9b"]]},{"id":"b2e942c4.d7e9b","type":"influxdb out","z":"810b338d.3f2a9","influxdb":"18285695.aa63d9","name":"","measurement":"rhenen","precision":"","retentionPolicy":"","x":910,"y":140,"wires":[]},{"id":"18285695.aa63d9","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"Test (local)","usetls":false,"tls":""}]

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [18 May 2019 08:31 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/25 "2019-05-18T08:31:12Z")

</div>

You are trying to insert the output of the html request. Read my comment above, change lux:lux into waterstand:waterstand ( or something) and measurement as well, connect it to a batch node and it works.

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2019 09:24 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/26 "2019-05-18T09:24:23Z")

</div>

You mean like this?

 ![bk](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/7/757c7263327e6c0a96070e096d3f6504aa1c7ac4.png)

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2019 09:35 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/27 "2019-05-18T09:35:03Z")

</div>

Thanks both for helping and waking me up, it's working now! For those who are interested the flow below.

```auto
[{"id":"eb4a51fd.b1152","type":"tab","label":"Bakman","disabled":false,"info":""},{"id":"dd29d774.22daa8","type":"debug","z":"eb4a51fd.b1152","name":"Output Rhenen","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload[0].fields.rhenen","x":940,"y":60,"wires":[]},{"id":"42668027.172af","type":"inject","z":"eb4a51fd.b1152","name":"240'","topic":"","payload":"","payloadType":"date","repeat":"14400","crontab":"","once":true,"onceDelay":0.1,"x":230,"y":100,"wires":[["3928bb4d.961e94"]]},{"id":"3928bb4d.961e94","type":"http request","z":"eb4a51fd.b1152","name":"HTTP Request Rhenen","method":"GET","ret":"obj","url":"https://waterinfo.rws.nl/api/detail?expertParameter=Waterhoogte ___20Oppervlaktewater___ 20t.o.v. ___20Normaal___ 20Amsterdams ___20Peil___ 20in___20cm&locationSlug=Grebbe%28GREB%29&user=publiek","tls":"","x":430,"y":100,"wires":[["5e8a4a4c.2a0ec4"]]},{"id":"5e8a4a4c.2a0ec4","type":"function","z":"eb4a51fd.b1152","name":"Function Rhenen","func":"rhenen = msg.payload.latest.data\n\nmsg.payload = [\n {\n measurement:\"test\",\n fields: {\n rhenen:rhenen\n },\n }];\n\nreturn msg","outputs":1,"noerr":0,"x":670,"y":100,"wires":[["dd29d774.22daa8","aaa75e74.29b8a"]]},{"id":"aaa75e74.29b8a","type":"influxdb batch","z":"eb4a51fd.b1152","influxdb":"18285695.aa63d9","precision":"","retentionPolicy":"","name":"","x":930,"y":120,"wires":[]},{"id":"18285695.aa63d9","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"test","name":"Test (local)","usetls":false,"tls":""}]

```

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [18 May 2019 10:23 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/28 "2019-05-18T10:23:02Z")

</div>

Never give up 😉

Next step: grafana! 😅

---

<div class="post-metadata">

**Author:** ![HaVi](https://avatars.discourse-cdn.com/v4/letter/h/b3f665/32.png) [@HaVi](https://discourse.nodered.org/u/HaVi)\
**Post date:** [18 May 2019 11:57 UTC](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074/29 "2019-05-18T11:57:40Z")

</div>

Indeed, never give up and patience... Grafana works perfect allready!

[Previous page](https://discourse.nodered.org/t/writing-http-request-values-to-influxdb/11074.md?page=1)
