Make Charts with API

Hi,

I am new to redash and think it could be great for the company I am working for. Our use case is to make a lot of identical dashboards with one different query parameter. It works great from the site, but wouldn’t be feasible to make a new dashboard for every client.

I understand you all have the API, and I assume it is possible, but if someone could point me to any code where someone makes a dashboard, some plots, and refreshes, that would be a huge help.

One final question: I love redash’s UI… could I make a dashboard by hand on the site, get all the objects, and then use that to make the new dashboards? Or would that not be the way to go about it?

Thanks!

This is exactly how to do it. There’s an open PR on the redash-toolbelt repository here that shows how to duplicate a dashboard and its queries. It just copies the objects and re POSTs them with some changes.

In general the API can do everything the UI does. But the API for building visualizations isn’t documented. So it’s easiest to build what you want in the front-end and then copy the JSON objects from your network inspector or REST API client.

I did this before when I wanted to synchronize all the colors of my charts on a dashboard.

Thanks so much for this tip! Unfortunately, I am having trouble figuring out how to use this code.

Could you give me some examples of what appropriate parameters for these calls in main() might be? I haven’t found any documentation and have been trying to work backwards but no luck yet. Thanks!

client = Redash(redash_host, api_key)
duplicate(client, slug, prefix)

api_key = 123abc456 and found in the dashboard
redash_host = ? I have just been guessing
slug = ?
prefix = ?

Thanks for the clarification!