API 2 query with params

Hello.

I’m doing a query with api 2. And everything works fine, but when I want to put “params” in the “query” it doesn’t accept them and gives me an error (error @1:50-1:56: undefined identifier params) .

Both the url, the org and the token are correct. But when I want to put the bucket or the ‘range start’ as a parameter, I get the aforementioned error.

Thanks for the help.

{
“params”:{
“ex1”: “-30d”
},
“query”: “from(bucket: “prueba”) |> range(start: params.ex1)”,
“type”: “flux”
}

Only parameterized queries work with InfluxCloud?

With my local influxdb it doesn’t work?

How could I put parameters in this last case?

Thank you.

Exactly. Query parameters work only with InfluxDB cloud, currently.

You can use one of the official InfluxDB Clients. Some of them offer Flux DSL.

You need to concatenate the query, otherwise.

1 Like