From 771305b005d220c8462e78683c2f98050bf8b2bc Mon Sep 17 00:00:00 2001 From: Adam Groszer Date: Fri, 22 Sep 2023 20:46:19 +0200 Subject: [PATCH] added InfluxDB v2 HTTP API docs and some other minors --- docs/source/Controller/C011.rst | 35 ++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/docs/source/Controller/C011.rst b/docs/source/Controller/C011.rst index d37662a46e..79d78022a3 100644 --- a/docs/source/Controller/C011.rst +++ b/docs/source/Controller/C011.rst @@ -62,6 +62,11 @@ You can use this placeholders in http header and in the http body: * ``%vname4%`` will be replaced with Valuename 4 * ``%val1%`` will be replaced with the value 1 of the device which is sending data to this controller * ``%val2%`` will be replaced with the value 2 of the device which is sending data to this controller +* ``%val3%`` will be replaced with the value 3 of the device which is sending data to this controller +* ``%val4%`` will be replaced with the value 4 of the device which is sending data to this controller +* ``%unixtime%`` will be replaced with the Unix time (seconds since epoch) + +See also System variables You can also write things like this: @@ -71,8 +76,8 @@ You can also write things like this: Examples -------- -InfluxDB HTTP Api -^^^^^^^^^^^^^^^^^ +InfluxDB v1 HTTP API +^^^^^^^^^^^^^^^^^^^^ * HTTP Method: ``POST`` * HTTP URI: ``write?db=testdb`` @@ -89,9 +94,33 @@ InfluxDB HTTP Api See also `InfluxDB API description `_ +InfluxDB v2 HTTP API +^^^^^^^^^^^^^^^^^^^^ + +* HTTP Method: ``POST`` +* HTTP URI: ``api/v2/write?bucket=yourbucket&org=yourorg`` + +* HTTP Header: + +.. code-block:: none + + Content-Type: application/x-www-form-urlencoded + Authorization: Token yourtoken + +* HTTP Body: + +.. code-block:: none + + esp,unit=%sysname%,device=%tskname%,sensor=%vname1% value=%val1% %unixtime%%LF%%2%esp,unit=%sysname%,device=%tskname%,sensor=%vname2% value=%val2% %unixtime%%/2%%LF%%3%esp,unit=%sysname%,device=%tskname%,sensor=%vname3% value=%val3% %unixtime%%/3%%LF%%4%esp,unit=%sysname%,device=%tskname%,sensor=%vname4% value=%val4% %unixtime%%/4%%LF% + +Make sure the body is all ONE single line, InfluxDB seems to be very picky about newlines. + +Response should be 204 on success. + + Nettemp HTTP Api ^^^^^^^^^^^^^^^^ untested but should work with something like this: -``/receiver.php?device=ip&type=%1%%vname1%%/1%%2%;%vname2%%/2%%3%;%vname3%%/3%%4%;%vname4%%/4%&value=%1%%val1%%/1%%2%;%val2%%/2%%3%;%val3%%/3%%4%;%val4%%/4%`` \ No newline at end of file +``/receiver.php?device=ip&type=%1%%vname1%%/1%%2%;%vname2%%/2%%3%;%vname3%%/3%%4%;%vname4%%/4%&value=%1%%val1%%/1%%2%;%val2%%/2%%3%;%val3%%/3%%4%;%val4%%/4%``