yesterday
Hi all!
I'm trying to identify the owner of a dashboard using the API.
Here's a code snippet as an example:
import json
dashboard_id = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
url = f"{workspace_url}/api/2.0/lakeview/dashboards/{dashboard_id}"
headers = {"Authorization": f"Bearer {token}"}
response = requests.get(url, headers=headers)
response.raise_for_status()
data = response.json()
print(json.dumps(data, indent=2))This call returns:
dashboard_id, display_name, path, create_time, update_time, etag, serialized_dashboard, lifecycle_state and parent_path.
The only way I'm able to see the owner is in the UI.
Has someone faced this issue and found a workaround?
Thanks.
yesterday
Lakeview (AI/BI) dashboards GET endpoint doesn’t return an explicit owner field. Use the Workspace Permissions API to infer the owner from the ACLs.
import requests
dash = requests.get(f"{workspace_url}/api/2.0/lakeview/dashboards/{dashboard_id}",
headers=headers).json()
path = dash["path"] # e.g., "/Users/alice@example.com/Folder/MyDash.lvdash.json"
st = requests.get(f"{workspace_url}/api/2.0/workspace/get-status",
params={"path": path}, headers=headers).json()
resource_id = st["resource_id"]
perms = requests.get(f"{workspace_url}/api/2.0/permissions/dashboards/{resource_id}",
headers=headers).json()
owner = None
for ace in perms.get("access_control_list", []):
perms_list = ace.get("all_permissions", [])
has_direct_manage = any(p.get("permission_level") == "CAN_MANAGE" and not p.get("inherited", False)
for p in perms_list)
if has_direct_manage:
# prefer user_name, but could be group_name or service_principal_name depending on who owns it
owner = ace.get("user_name") or ace.get("group_name") or ace.get("service_principal_name")
break
print("Owner:", owner)
yesterday
Unfortunatly the issue persists. All permissions are inherited: True. This happens when the dashboard is in a shared folder and the permissions come from the parent folder, not from the dashboard itself.
permissions: {'object_id': '/dashboards/<redacted>', 'object_type': 'dashboard', 'access_control_list': [{'user_name': '<redacted>', 'display_name': '<redacted>', 'all_permissions': [{'permission_level': 'CAN_EDIT', 'inherited': True, 'inherited_from_object': ['/directories/<redacted>']}]}, {'user_name': '<redacted>', 'display_name': '<redacted>', 'all_permissions': [{'permission_level': 'CAN_MANAGE', 'inherited': True, 'inherited_from_object': ['/directories/<redacted>']}]}, {'group_name': '<redacted>', 'all_permissions': [{'permission_level': 'CAN_MANAGE', 'inherited': True, 'inherited_from_object': ['/directories/']}]}]}
yesterday
Hi @ruicarvalho_de - Note sure, can you please give a try to use " /api/2.0/preview/sql/dashboards/{dashboard_id}". see the documentation details below.
https://docs.databricks.com/api/workspace/dashboards/get
yesterday
Yes, tried it but failed. This is for legacy dashboards, I'm using lakeview dashboards.
Status: 404 {'message': 'GetDashboardHandler failed to parse request. Please check dashboard id for errors.'}
yesterday
Hi @ruicarvalho_de - Ok got it. Let me explore on the api for lakeview dashboards.
yesterday
@ruicarvalho_de I don't think we have a direct way to fetch the owner of the dashboard through API.
We can try using an API call to retrieve the dashboard IDs and then use the following API call /api/2.0/permissions/{workspace_object_type}/{workspace_object_id} to get the object permissions. However, it still will not provide a single, authoritative “owner” field; instead, you only get all principals and their permission levels on each dashboard.
9 hours ago
Is there any reason for that information is not available directly?
Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!
Sign Up Now