Query not giving errors, and not giving data

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

I think you need to escape (with \ ) the two quotes " around _field.

Antony.

it still gives the same result, thank you though

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.

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

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.

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

Okay, we’re both making mistakes now :frowning:

I said --data-urlencode=“db=netatmo”

That is wrong and should be --data-urlencode “db=netatmo”

Antony.

it still gives no data or error message.

I’m starting to think there’s something wrong with the query