httr POST error: “invalid charachter '-' in numeric literal”

I am trying to query data from InfluxDB 1.8.4 (with Flux enabled) in R Studio. I can't figure out what's wrong with my code:

dburl <- "http://localhost:8086/api/v2/query"

influxquery <- sprintf(
  'from(bucket: "plcview/autogen")
    |> range(start: 2017-06-27T04:16:58.278Z, stop: now())
    |> filter(fn: (r) => r._measurement == "MONITORING")
    |> map(fn:(r) => ({ r with _time: uint(v:r._time) }))'

           add_headers('Content-Type: application/vnd.flux',
                       'Accept: application/csv',
                       'Accept-Encoding: application/gzip'),

The data I am trying to get looks like this:

time                     MONITORING equipmentNumber workplace
----                     ---------- --------------- ---------
2017-06-27T02:16:58.599Z 1          L4212M1017      3
2017-06-27T02:16:58.6Z   1          L4212M1017      4
2017-06-27T02:16:58.6Z   1          L4212M1017      1
2017-06-27T02:16:58.6Z   1          L4212M1017      2
2017-06-27T02:17:03.14Z  0          L4212M1017      1
2017-06-27T02:17:03.14Z  0          L4212M1017      2
2017-06-27T02:17:03.14Z  0          L4212M1017      4
2017-06-27T02:17:20.007Z 1          L4212M1017      1
2017-06-27T02:17:36.988Z 1          L4212M1017      4
2017-06-27T02:17:36.988Z 1          L4212M1017      2

I always get this error message:

Response [http://localhost:8086/api/v2/query]
  Date: 2021-04-08 14:19
  Status: 400
  Content-Type: application/json
  Size: 53 B
{"error":"invalid character '-' in numeric literal"}

I can push the same request through (with all those parameters) using Postman. Why doesn't it work in R? Is it maybe a problem with the way R stores the data? I thought it could be the Timestamp form my time series data in rfc339 format (which has '-' to separate the dates, could that be the reason?).

Any ideas? I am new to Influx and R so I appreciate any help I can get.
Thank you guys!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.