Does Redash have a REST API?

Does Redash have a REST API for managing

  • users,
  • groups,
  • queries,
  • dashboards,
  • alerts,
  • etc…?

Is the API documented?

Thanks!

2 Likes

Yes it does have a rest API. It is not feature complete, and not documented other than the actual code.

(I am developing against it now, and that development is how I gained the above knowledge)

Same here. We understood the API reading the code. In our case we use it because we developed a small tool so we can have the queries controlled on git and this way is easy deploy new instances having test and prod environments. It would be great if this API was documented.

Great thank you.

I found these to places to be the best starting places:
https://github.com/getredash/redash/blob/5aa620d1ec7af09c8a1b590fc2a2adf4b6b78faa/redash/handlers/api.py
https://github.com/getredash/redash/tree/5aa620d1ec7af09c8a1b590fc2a2adf4b6b78faa/redash/handlers

(Posted on Slack channel, copied here given the more targeted audience.)

Hi,

I think it’s the case, but I want to be sure: Can I do all of the following over the REST API:

  • retrieve a list of visualizations (filtered by what the user is allowed to see)?
  • retrieve just the underlying data of that visualization as a table?
  • retrieve just the graphically elements of the visualization?
    (all filtered really by what the api user is authorized to see)

We’re considering using redash as an analytics generator, which then our other applications (web or desktop) make REST calls against to retrieve any of the following:

  • the basic data table(s)
  • the graphical element(s)
  • an HTML block suitable for use within an iframe
  • ibid but with the iframe itself included in the result
  • a complete dashboard (which of course may have one or more visualizations)

Of course too we’ll need to retrieve collections of:

  • visualizations
  • dashboards

I already had in mind to use redis to cache results, and from a brief look at the code, it seems that redash implements some form of such caching with redis.

At present and for a while we don’t expect to be needing to send parameters and retrieve results based on those parameters, but eventually will. From my brief reading it seems that this is a priority item already under development and in some cases working. Have I understood correctly?

In summary, in addition to using redash itself for certain managment and administrative users (lesser use case), it’s important we be able to pull out of redash (ideally over REST) whatever dashboards, visualizations, or visualization element(s) we want so they can be presented elsewhere (greater use case). It seems redash can do this, and likely quite well.

But I’d be most grateful to hear from someone with experience (developer or user) to confirm or disconfirm my understanding, and, if possible, provide any pointers re: good places to start, gotcha’s and “watch out”, etc.

Thanks so much!

Doug

Oh, in addition:

We’ll be wanting to retrieve “stored” visualizations / dashboards (e.g., many of these analytics need only be generated every so many hours, days, or weeks) as well as visualizations / dashboards that are generated upon each request. We also have in mind to expire the redis cache for certain analytical results when we know they should be recomputed (e.g., regional distribution summary for a given product only need be updated when the product is sold, thus our ERP sends a message on a message queue, our control server listens for such messages and expires the relevant analytical results in the redis cache for redash, and thus upon next request regenerates the visualization, puts it back in the cache, and sends it to the requesting user or application). Something like this possible?

I should probably mention: We’ll be self hosting, and always will have to, given the sensitive nature of our data. My understanding there is at present no difference for cloud vs self hosted, but of course that could change.

Did you find out the answer to your questions?
"I think it’s the case, but I want to be sure: Can I do all of the following over the REST API:

  • retrieve a list of visualizations (filtered by what the user is allowed to see)?
  • retrieve just the underlying data of that visualization as a table?
  • retrieve just the graphically elements of the visualization?
    (all filtered really by what the api user is authorized to see)"

If we can do all of that, could you please refer me to the API docs? Thanks a lot!

  • Amit

Hi Amit,

Redash uses a REST API behind the scenes but it isn’t formally documented (we’re working on this).

  1. Not exactly. The visualizations aren’t handled by an API but by Plotly. AFAIK Plotly doesn’t expose an API for what information is currently displayed to the user.
  2. Yes absolutely. There are numerous examples of fetching query results via the API on this forum.
  3. I don’t understand how this differs from your first question. Would you clarify?

I think that clarifies a lot. Thanks Jesse.

Hey @jesse , can you clarify, are we still not able to fetch list of visualizations present in a dashboard by hitting an API ?

This has always been possible. Fetching from the dashboards endpoint returns such a list.

If the language you’re calling from is Go, then the unofficial “Redash Go SDK” might do what you’re after: