Skip to main content

InfluxDB API

InfluxDB v2 API

Check the InfluxDB v2 API reference for details about API endpoints.

InfluxDB API can be used to retrieve and update data via Data Manipulation Panel.

Thanks to the community member fercasjr for the provided examples.

Query data

Update according to your environment:

  • IP address or name of the server (localhost in the example)
  • InfluxDB org
  • Token
  • Query is represented by any valid query you already have to test.
docs/volkovlabs-form-panel/js/influx-query.js
loading...

To write data to InfluxDB you can use the experimental.to(), wide.to(), or to()` functions in the Flux language or use the API.

Write data

The generated payload of the HTTP POST request includes the following:

  • measurement_name: name of the measurement that is written into InfluxDB (in this example is hardcoded).
  • tag1: name of the tag that is written into InfluxDB (also hardcoded).
  • field1 and field2: names of fields that are written into InfluxDB (also hardcoded).
  • body.element_id1 and body.element_id2: field values that are written into InfluxDB.
  • Date.now(): code snippet for generating the timestamp of the measurement (is in ms).

The body's elements are coming from the plugin's form, that's why they are placed inside the ${}.

  • body.element_id1 is getting the element_id1 value from the body object.
docs/volkovlabs-form-panel/js/influx-write.js
loading...