Skip to content

Commit

Permalink
Merge pull request #4816 from agroszer/mega
Browse files Browse the repository at this point in the history
added InfluxDB v2 HTTP API docs and some other minors
  • Loading branch information
TD-er authored Sep 30, 2023
2 parents 361894a + 771305b commit b5b9156
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions docs/source/Controller/C011.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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``
Expand All @@ -89,9 +94,33 @@ InfluxDB HTTP Api
See also `InfluxDB API description <https://docs.influxdata.com/influxdb/v1.5/guides/writing_data/#writing-multiple-points>`_

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%``
``/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%``

0 comments on commit b5b9156

Please sign in to comment.