Programatically creating dashboards


#1

Hi guys,

We want to reuse dashboards. What we’re after is the ability to copy an existing template and then modify it to suit our needs.

I’ve seen the Dashboard REST api, but I couldn’t see anything talking about modifying the blocks in a dashboard.

Is it possible to copy / clone an existing dashboard?
Is it possible to create / modify the blocks in a dashboard?


#2

Is it possible to copy / clone an existing dashboard?

Yes, from your list of dashboards you should see a “Clone” button on the right side (assuming you have write-level access to the dashboard).

Is it possible to create / modify the blocks in a dashboard?

The block configuration, sadly, is not very well documented - but we’re working on that. As for modifying blocks, have you checked out dashboard context? That may provide you the flexibility you’re looking for as you can use context variables to change queried devices, queried attributes, and some presentation properties.


#3

I was aware of the clone dashboard button. What does this equate to under the hood in terms of Losant API?

We may be able to coerce the dashboard context variables, but I suspect we will want to programatically configure the blocks themselves. Is programatic block configuration possible?


#4

API-wise, cloning a dashboard isn’t anything fancy. We’re just taking an existing dashboard object and POSTing it as a new dashboard - with a couple properties stripped out as the request would fail if they were included.

As for programmatic block configuration, dashboard context is all we have for that at the moment.