InfluxDB v2.0.0-alpha Query API via Postman

Hi

I am trying to use Postman to test queries on v2.0.0-alpha. I cannot find any examples using the JSON body with the “query” key. Documentation says “query”: “string”. I have tried the following as the JSON body:

{
“query”: “from(bucket: ‘datasourceId’) |> range(start: -1h, stop: -1m) |> filter(fn: ® => r._measurement == ‘m’) |> filter(fn: ® => r._field == ‘q’) |> filter(fn: ® => r.t== ‘name001’)”
}

But get the following response:
{
“code”: “invalid”,
“message”: “failed to execute query against proxy service”,
“op”: “http/handlePostQuery”,
“error”: {
“code”: “invalid”,
“message”: “compilation failed: loc 1:6-1:27: invalid expression @1:27-1:28: '”
}
}

Thanks

donot use json as content type, just raw test. Like this:

Hi @kilik52, thanks for your response.

However, even when using the “Text” body of:

from(bucket: “datasourceId”) |> range(start: -10h)

I am getting the following error response:
{
“code”: “invalid”,
“message”: “failed to decode request body”,
“op”: “http/handlePostQuery”,
“error”: “invalid character ‘r’ in literal false (expecting ‘a’)”
}

I am not sure which character ‘r’ is causing the issue?

Hope you can assist.
Thanks

u may upload some screenshot. let me see ur headers and body

Thanks @kilik52. See my screenshots. The only header I am adding is the Token.

try add another header:

Content-Type: application/vnd.flux

1 Like