cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dashboard API - Create a dashboard object doesn't work

Mist3
New Contributor II

I am trying to copy a dashboard object from one workspace to another using API. 

I am using Get dashboard objects (/api/2.0/preview/sql/dashboards GET method), then Retrieve a definition (/api/2.0/preview/sql/dashboards/{dashboard_id} GET method) and after retrieving a definition. Until this step, everything seems fine, but the last step in my opinion is somehow broken. I am trying to restore the dashboard using Create a dashboard object (/api/2.0/preview/sql/dashboards POST method). The engine will return 200 and the object created but the widgets are equal to None, so the object is created and visible on Dashboards screen but in fact, it is quite empty. 

Can you help me? 

9 REPLIES 9

Anonymous
Not applicable

@Mariusz Czak​ :

Here are a few things you can check:

  1. Make sure that you are passing all the required parameters to the Create a dashboard object API endpoint. Check the API documentation to see if there are any parameters that you might have missed.
  2. Verify that the widget IDs in the original dashboard are unique and that they are not used in any other dashboards or widgets in the new workspace. If the IDs are not unique, it could cause conflicts during the copying process.
  3. Check if the widgets in the original dashboard are using any resources or connections that are not available in the new workspace. If so, you may need to create those resources or connections in the new workspace before you can successfully copy the dashboard.
  4. Try creating a new dashboard manually in the new workspace and add a few widgets to it. Then, retrieve the definition of the new dashboard and compare it to the definition of the original dashboard to see if there are any differences. This may give you some clues as to what might be causing the issue.

Let me know if any of the above suggestions work for you, if not we can try and figure out more.

Anonymous
Not applicable

Hi @Mariusz Czak​ 

Thank you for posting your question in our community! We are happy to assist you.

To help us provide you with the most accurate information, could you please take a moment to review the responses and select the one that best answers your question?

This will also help other community members who may have similar questions in the future. Thank you for your participation and let us know if you need any further assistance! 

AndyM
New Contributor II

Any updates on this? I'm facing the same issue. I deleted the original dashboard and tried to recreate it with the template which at least would map the dashboard to the original resoureces. The result was the same that @Mist3 had.

Gutek
New Contributor II

I'm facing the same issue. I'm even trying to duplicate a dashboard on the same environment, which would rule out any issue of missing resources. The dashboard is created empty; no widgets. Either the API is broken or the documentation is misleading. From the docs:

"Other fields can be included when duplicating dashboards with this API"

miranda_luna_db
Contributor III

Hi there - 

We recommend using the export/import API for moving Lakeview dashboards between workspaces. Documentation of the capability here

We'll take a look at the current DBSQL dashboard GET/CREATE/UPDATE API and improve clarity there.

Gutek
New Contributor II

Hi @miranda_luna_db , unfortunately, when it comes to Lakeview dashboards, the workspace API documentation is equally confusing: check out my thread.

Will reply on that thread.

markusk
New Contributor II

Hey @miranda_luna_db, is there any update or suggestions for the SQL dashboards (so not Lakeview).

I am experiencing exactly same behaviour when attempting to deploy dashboards through the API. I have first fetched an existing definition and I am attempting to create a new dashboard. Creating a dashboard succeeds but the "widgets" property is always null and thus the dashboards end up empty. I feel like my attempt is aligned with the create dashboard API documentation:
"Other fields can be included when duplicating dashboards with this API. Databricks does not recommend designing dashboards exclusively using this API."

The lakeview dashboards are not really an option at the moment for my team as they do not support query parameters.

eason_gao_db
New Contributor II

Hi @markusk, unfortunately the issue you're running into is a limitation of the outgoing SQL dashboard APIs. You can create blank dashboards, but you cannot programmatically insert existing definitions. 

The good news is we're currently running a preview for import/export APIs that addresses precisely this. The import/export APIs allow you to create new or override existing dashboards with an existing definition. If you'd like access, please work with your account team to get set up. 

On the Lakeview front, parameter support is top of mind for us! 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group