Munin
Munin

Reputation: 1649

Flux via cURL will not run if the input data file contains import statement

Following is working in REPL mode:

influx -precision rfc3339 -type=flux -path-prefix=/api/v2/query

> bName = "benchmark_db/autogen"
> import "influxdata/influxdb/v1"
> v1.measurements(bucket: bName)

I would like to wrap the query. According to this doc, I created a script called demo.flux under /home/demo.flux and put the above content in it and initiate following statement:

curl -XPOST localhost:8086/api/v2/query -sS -H 'Accept:application/csv' -H 'Content-type:application/vnd.flux' --data-binary "@/home/demo.flux"

However, it returns with an error:

error
loc 3:1-3:7: invalid statement @3:1-3:7: import

Upvotes: 1

Views: 290

Answers (1)

alespour
alespour

Reputation: 465

import statement must be first, before any other declarations.

Upvotes: 1

Related Questions