OD-OD
OD-OD

Reputation: 1

Send HTTP POST request to InfluxDB manually with browser

Hello,

I'm currently using grafana to visualize data from InfluxDB, and would like to use a hyperlink in form of a HTTP request from a dashboard to insert data into the database.

Is something like this possible?

Upvotes: 0

Views: 1304

Answers (1)

Munin
Munin

Reputation: 1649

This is possible.

In InfluxDB v1.X, you could do:

curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

In InfluxDB v2.X, you could do:

curl --request POST \
"http://localhost:8086/api/v2/write? 
org=YOUR_ORG&bucket=YOUR_BUCKET&precision=ns" \
--header "Authorization: Token YOUR_API_TOKEN" \
--header "Content-Type: text/plain; charset=utf-8" \
--header "Accept: application/json" \
--data-binary '
airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000
airSensors,sensor_id=TLM0202 temperature=75.30007505999716,humidity=35.651929918691714,co=0.5141876544505826 1630424257000000000
'

See more details here and there.

Upvotes: 1

Related Questions