Dashboard update through API

pawelzak
Databricks Partner

Hi,

I would like to create / update dashboard definition based on the json file. How can one do it? I tried the following:

databricks api post /api/2.0/preview/sql/dashboards/$dashboard_id --json @file.json

 

 

But it does not update the widgets...

How can this be solved, I need to be able to create / update the dashboards programatically

Regards,

Pawel

Gamlet
New Contributor II

To programmatically create/update dashboards in Databricks using a JSON file, you can use the Databricks REST API's workspace/export and workspace/import endpoints. Generate a JSON representation of your dashboard using workspace/export, modify it as needed, and then use workspace/import to update or create the dashboard with the modified JSON definition.

Best wishes, Zpak

pawelzak
Databricks Partner

Hi Zpak,

Could you please elaborate? I can not export the dashboard, the following error is returned:
Request: databricks api get /api/2.0/workspace/export --json '{"path": "/Shared/t1"}'
Error: "Error: dbsqlDashboard is not user-facing."

Thanks,

Pawel