I am trying to interface an ewon flexy with an InfluxDB along the same lines as the first part of the following post:
The Influx database is hosted on machine A
I have successfully used CURL (from the windows command line) on machine B to submit data using the Influx line protocol.
Using the Flexy IDE, I can successfully ping machine A,
I’m not having any luck getting the Flexy to submit data.
url$ = "http://XX.X.X.XX:8086/api/v2/write?org=XXX&bucket=Flexy205&precision=ns"
method$ = "POST"
header$ = "Authorization: Token XXXXXXXXXX==, Content-Type: text/plain, charset: utf-8, Accept: application/json"
DataToPost$ = "airSensors,sensor_id=Flexy205 temperature=33.33,humidity=33,co=0.33"
REQUESTHTTPX url$, method$, header$, DataToPost$
If i run:
PRINT "status: "; RESPONSEHTTPX "HEADER"
It returns: “status: ???”
I think the issue lies in the formatting of the headers sent in the initial REQUESTHTTPX command, but i’ve tried most variations that I can think of with no success.
For reference the CURL script that works:
curl --request POST "http://XX.X.X.XX:8086/api/v2/write?org=XXX&bucket=Flexy205&precision=ns" --header "Authorization: Token XXXXXXXXXXX==" --header "Content-Type: text/plain; charset=utf-8" --header "Accept: application/json" --data-binary "airSensors,sensor_id=WIN10 temperature=73.97,humidity=35.23,co=0.48"