Skip to main content

InfluxDB API

InfluxDB v2 API

Consult with the InfluxDB v2 API reference for details about API endpoints.

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

Thanks to community member fercasjr for examples.

Query data

Update according to your environment:

  • IP address or name of the server (localhost in the example)
  • InfluxDB org
  • Token
  • Query could be any valid query you already have to test.

To write data to InfluxDB you can use, or to() functions in the flux language or use the API.

Write data

The generated payload of the HTTP post consists of:

  • measurement_name will be the name of the measurement to be used in InfluxDB (in this example is hardcoded).
  • tag1 is the name of the tag to be used in InfluxDB (also hardcoded).
  • field1 and field2 will be the names of the fields to be used in InfluxDB (also hardcoded).
  • body.element_id1 and body.element_id2 are the values for the fields to be used in InfluxDB.
  • is a piece of code just for generating the timestamp (is in ms).

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

  • body.element_id1 is getting the element_id1 value from the body object.