getState and setState API Demo
This page demonstrates the getState and setState methods from the Rill Iframe API. These methods allow you to programmatically control and monitor the state of an embedded Rill dashboard using the postMessage API.Try the interactive controls below to see these methods in action!
setState Controls - Click to change dashboard view:
getState Control - Get current dashboard state:
getState() Method
Retrieves the current state of the embedded dashboard as a URL query string. This includes the current view, filters, time ranges, and other dashboard configurations. Use this to capture and save dashboard states or to synchronize multiple dashboards.
Response: { "id": 1, "result": "view=explore&tr=PT24H&grain=hour&..." }
setState(state) Method
Sets the current state inside the iframe. You can use this to programmatically change views, apply filters, or modify the dashboard configuration. The state parameter should be a URL query string with the desired dashboard parameters.
Response: { "id": 1, "result": true }