Getting dashboard data via API
AnsweredHi
Is there an API to retrieve dashboard-specific data (widgets, filters etc.)?
Thanks
Amir
-
Hi Amir,
Of course there is - the Dashboards API v1.0
For example, you can retrieve a dashboard by ID:
http://localhost:8081/api/v1/dashboards/588149043aadeb6c43000012
Which will return a JSON containing various fields such as datasource (the cube used), filters, and layout.
The layout is comprised of cells, and alongside the UX properties like the cell's size, you can find the widget ID for each cell. Subsequently, you can find the dashboard's widgets like so:
http://localhost:8081/api/v1/dashboards/588149043aadeb6c43000012/widgets
Which will return an array of all widget objects, or a specific widget like so:
http://localhost:8081/api/v1/dashboards/588149043aadeb6c43000012/widgets/588149603aadeb6c43000015
Note: when specifying a widget's or dashboard's ID you need the "oid" property and not the "_id" property!
You can find more information about these APIs in our Online API Reference / V1 / Dashboards
-
Amir, when you say "return the data as well" do you mean the actual data from Elasticube?
In that case, no. The Dashboard and Widget REST API return metadata - JSON that describes the dashboards and widgets. The Elasticube data is returned in response to each individual widget's query, composed based on that widget's metadata.
We do not have an API that will return Elasticube data by Widget ID simply because it's not possible - the query depends on interaction with other aspects such as the user's data security permissions, dashboard filters, etc.
To get started with understanding how our queries work and how you can extract the actual data behind various widgets, I'd recommend taking a look at our JAQL documentation, as well as these forums posts:
- Extracting data from widgets
- Viewing the underlying JAQL & SQL of widgets
- JAQLine - plugin for query visualization
It can also be helpful if you could specify what it is you're trying to accomplish. Good luck!
-
Hi Moti Granovsky
Can we get the JAQL code mentioned on step a here but via API call?
BR -
Hi Luis, if you mean specifically REST API and not Javascript API (that's still an API) - the answer is no, unfortunately.
The JAQL query is constructed on the client side and thus only available there.
You could construct it yourself based on Dashboard and Widget metadata but of course that's a lot more work than using the JS API method in the link.
Please sign in to leave a comment.
Comments
8 comments