Creating a link to instantly download CSV from bucket (in web UI) w/ query?

I have been developing a simulation tool that uses a Javscript frontend to present data that is computed by a backend server, which itself sends that data to InfluxDB 2.0. I would now like to implement functionality so that I can click a button that will send me to the flux bucket with a pre-prepared query, and ideally then automatically starts to download that data as a CSV.

I currently have set up the button so that it takes me directly to the bucket (after passing the login screen). Is it possible to create a link which includes a query to automatically get data from the bucket?

I would like to try avoiding the use of the InfluxDB 2 client in JavaScript for the purposes of security and speed (that is, preventing users from directly accessing the database as much as possible); I’m fine with logging in to get the data, however.

I should also specify that the buckets used for holding the data are created at runtime (meaning no setup of variables via the UI beforehand), and that in general, I would like the user to do as little preparation before downloading the data as possible.

Hello @jos,
Named and parameterized flux functions don’t exist yet, but are landing shortly in Cloud (within a couple of sprints I believe). You’ll be able to create a named function and associated function resource with a function id. Then you can invoke the function by using the function id and pass in the parameters in the body of your request.
Is that along the lines of what you’re looking for?

@Anaisdg two questions regarding this:

  1. Would I be able to set this up without touching the UI at any point before I actually make the URL call to get this data? Or is this something that has to be set up first?
  2. I unfortunately don’t use cloud, I use OSS. Is it coming to that as well or will it be a while before it shows up?

Hello @jos,
Yes you would be able to set this up without touching the UI at any point. You would just need a token and an orgID.
It should be coming to OSS too. However I don’t know what the timeline is for OSS. I’ll ask and get back to you.

1 Like