The Luzmo API enables developers to programmatically interact with Luzmo. Anything that can be done in the dashboard editor can be done via the API and much much more!

Retrieving a List of All Dashboards Using a Specific Dataset

Let's say you have a dataset in Luzmo, and you want to know which dashboards are using this dataset. To retrieve this information, you can use the Luzmo API and send a request to the "securable" endpoint. The following code snippet demonstrates how to retrieve a list of all dashboards using a specific dataset:

client.get('securable', {
  where: {
    type: 'dashboard'
  },
  attributes: ['id'],
  include: [{
    model: 'Securable',
    as: 'Datasets',
    attributes: ['id'],
    required: true,
    where: {
      id: '< dataset id >'
    }

In this code snippet, we are sending a request to the "securable" endpoint and filtering the results to only return dashboards. We are also including the datasets that are associated with each dashboard. To filter the results by a specific dataset, we use the "where" option to specify the dataset's ID.

When the request is successful, the response will contain a list of dashboard IDs that are using the specified dataset.

Retrieving a List of All Datasets Used in a Specific Dashboard

Similarly, you can use the Luzmo API to retrieve a list of all datasets used in a specific dashboard. To do this, you can send a request to the "securable" endpoint and include the dashboards that are associated with each dataset. The following code snippet demonstrates how to retrieve a list of all datasets used in a specific dashboard:

client.get('securable', {
  where: {
    type: 'dataset'
  },
  attributes: ['id'],
  include: [{
    model: 'Securable',
    as: 'Dashboards',
    attributes: ['id'],
    required: true,
    where: {
      id: '<< dashboard-id >>'
    }
  }]
})

In this code snippet, we are sending a request to the "securable" endpoint and filtering the results to only return datasets. We are also including the dashboards that are associated with each dataset. To filter the results by a specific dashboard, we use the "where" option to specify the dashboard's ID.

When the request is successful, the response will contain a list of dataset IDs that are used in the specified dashboard.

Need more information?

Do you still have questions? Let us know how we can help.
Send us feedback!