Fetching Dashboards

Initializing the Vizzly API

Ensure you have loaded the Vizzly package by following the prerequisite steps in our initializing guide. You will then be able to instantiate the Vizzly API using the following code

const api = new Vizzly.API(<< Identity function >>);

Note that << Identity function >> is your identity function itself, not the returned value from it. Feel free to reuse the same identity function that you use to render the Vizzly dashboard. For more information about the identity function, see the identity docs

This section details the various methods available via our API for retrieving dashboards. These methods cater to different requirements, whether it's an overview of all dashboards, a focus on child dashboards, or access to parent dashboards.

Dashboard Retrieval Methods

All Dashboards

The getDashboards method provides all child dashboards for the default parent dashboard.

const allDashboards = await api.getDashboards();

All Child Dashboards

To retrieve child dashboards linked to parent dashboards, the getAllChildDashboards method is utilized. This function returns an exhaustive list of child dashboards.

const childDashboards = await api.getAllChildDashboards();

Parent Dashboards

For an enumeration of top-level dashboards, often serving as main categories or starting points for subordinate dashboards, the getParentDashboards method is appropriate. This function yields a list of all dashboards classified as parents.

const parentDashboards = await api.getParentDashboards();

Child Dashboards of a given Parent

The getChildDashboards method is designed to retrieve child dashboards specific to a given parent dashboard. This method requires the ID of the parent dashboard for which child dashboards are sought.

// Replace << PARENT DASHBOARD ID >> with the actual Parent Dashboard ID
const specificChildDashboards = await api.getChildDashboards(<< PARENT DASHBOARD ID >>);