ener
1
I’m trying to gather a specific metric from InfluxDB using curl. The command I’m trying to use is
curl -i -G ‘10.14.36.25:8090/query?db=netatmo’ --header “Authorization: Token MYTOKEN” --data-urlencode “q=SELECT * FROM “_field” WHERE ("entity_id"=‘unknown_70_ee_50_90_f4_42_vindmolle_wind_angle’)”
Running this command gives me this message:
HTTP/1.1 200 OK
Content-Type: application/json
Vary: Accept-Encoding
X-Influxdb-Build: OSS
X-Influxdb-Version: v2.7.6
Date: Mon, 17 Jun 2024 09:55:52 GMT
Content-Length: 33
{“results”:[{“statement_id”:0}]}
I’m quite new to Influx so the issue might be obvious, but I can’t seem to find out what’s wrong.
This database is connected to Home Assistant. I have manually changed the port from :8086 to :8090
Pooh
3
I think you need to escape (with \ ) the two quotes " around _field.
Antony.
ener
4
it still gives the same result, thank you though
Pooh
5
The -G option to curl tells it to append the --data-urlencode values after the
specified URL, separated by a ?
However you already have a ? in the URL, so I suspect curl is ending up with a
path containing two ?s
Try this instead:
curl -i -G ‘10.14.36.25:8090/query’ --header “Authorization: Token MYTOKEN” –
data-urlencode=“db=netatmo” --data-urlencode “q=SELECT * FROM "_field" WHERE
("entity_id"=‘unknown_70_ee_50_90_f4_42_vindmolle_wind_angle’)”
Antony.
ener
6
I tried with --dataurlencode “db=netatmo” and still get the same result.
With data-urlencode=“db=netatmo” i get the error message "curl: option -data-urlencode=db=netatmo: is unknown
Pooh
7
I tried with --dataurlencode “db=netatmo” and still get the same result.
That has a missing dash in the parameter name.
With data-urlencode=“db=netatmo”
That is missing the two dashes preceding the parameter name.
i get the error message "curl: option -data-urlencode=db=netatmo: is unknown
My reply may have got split across lines.
My recommendation was --data-urlencode=“db=netatmo”
Antony.
ener
8
Oops, that was an error on my part when replying i tried with this command:
curl -i -G ‘10.14.36.25:8090/query’ --header “Authorization: Token xyz” --data-urlencode=“db=netatmo” --data-urlencode “q=SELECT "_value" FROM "_field" WHERE ("entity_id"=‘unknown_70_ee_50_90_f4_42_vindmolle_wind_angle’)”
and got this message
curl: option --data-urlencode=db=netatmo: is unknown
curl: try ‘curl --help’ or ‘curl --manual’ for more information
Pooh
9
Okay, we’re both making mistakes now
I said --data-urlencode=“db=netatmo”
That is wrong and should be --data-urlencode “db=netatmo”
Antony.
ener
10
it still gives no data or error message.
I’m starting to think there’s something wrong with the query