How to query data InfluxCloud API

Hi, everyone

How to query data in InfluxCloud API ?
I send this query in API, and return “could not find bucket”

It looks like something is wrong with the ecaping/backslash.
Compare the request payload with this:

https://docs.influxdata.com/influxdb/cloud/query-data/execute-queries/influx-api/

hi, how to scaping without backlash for postman ?

I tried it with Postman, the example below worked.
Just put the raw flux query into the raw Body (without any json structure or escaped characters):

from(bucket: "Computer")
  |> range(start: -1h)
  |> filter(fn: (r) => r["_measurement"] == "cpu")
  |> filter(fn: (r) => r["host"] == "work")
  |> filter(fn: (r) => r["cpu"] == "cpu-total")

And of course, set the headers according to the above linked documentation:

  • Authorization
  • Accept
  • Content-type

Its work, thanks bro!