Whats the best way to find broken visualizations t...
# gooddata-cloud
d
Whats the best way to find broken visualizations through API without having to click through each one or wait for a user to send a ticket. We want to know this when we make changes and there are no warnings that something would break (which does occur)
k
Currently, there is no direct API endpoint in GoodData Cloud that will automatically list all broken or non-functional visualizations in a workspace. This limitation is confirmed by multiple support responses: you cannot programmatically check for errors in all visualizations via the REST API, and there is no built-in resource to list non-functional objects after changes to the Logical Data Model (LDM) or metrics. The only automated warning is provided in the LDM editor UI, which highlights objects that will be affected by a change, but this is not exposed via API for bulk or automated checks across workspaces [Community Slack - detect broken visualizations](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1714128145139339?thread_ts=1714128145.139339&cid=C04S1MSLEAW) [Community Slack - API to check workspace errors](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1701461374089479?thread_ts=1701461374.089479&cid=C04S1MSLEAW). Workarounds and Options: - Python SDK: The recommended approach is to use the GoodData Python SDK to programmatically fetch all visualizations in a workspace and then attempt to validate or render them. This can help you detect broken visualizations as part of a CI/CD or automated monitoring process, but it requires custom scripting and is not available as a single REST API call [Python SDK get_visualizations](https://www.gooddata.com/docs/python-sdk/latest/api-reference/sdk/visualizationservice/get_visualizations/) [Community Slack - API to check workspace errors](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1701461374089479?thread_ts=1701461374.089479&cid=C04S1MSLEAW). - VS Code Extension: GoodData’s Visual Studio Code extension offers referential validation of workspaces, which can help identify broken references after LDM or metric changes. This is a manual or semi-automated process, not a REST API, but it is the closest available tool for bulk validation [Community Slack - detect broken visualizations](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1714128145139339?thread_ts=1714128145.139339&cid=C04S1MSLEAW). - Audit Logs: While audit logs can show who created or updated dashboards and visualizations, they do not provide information about whether a visualization is broken [Community Slack - audit logs](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1749761900525929?thread_ts=1749761900.525929&cid=C04S1MSLEAW). Summary: There is no out-of-the-box API to list all broken visualizations. The best available method is to use the Python SDK to fetch and validate visualizations programmatically, or to use the VS Code extension for referential validation. If this is a critical need, it is recommended to submit product feedback to GoodData for more robust monitoring and validation features in the future.
d
How would this work? Python SDK to fetch and validate visualizations programmatically, or to use the VS Code extension for referential validation.
I was already thinking that we would use the SDK but how would we know from JSON that it would be broken
m
@kapa.ai 💡 How would this work? Python SDK to fetch and validate visualizations programmatically, or to use the VS Code extension for referential validation. I was already thinking that we would use the SDK but how would we know from JSON that it would be broken
k
A message from kapa.ai
Using the Python SDK to programmatically check for broken visualizations works by attempting to execute each visualization and catching any errors that occur. The SDK does not provide a direct "is this visualization broken?" flag in the JSON, but you can infer breakage if an exception is raised when you try to fetch or compute the visualization. Here’s how you can do it: 1. Fetch all visualizations in a workspace:
Copy code
python    visualizations = sdk.visualizations.get_visualizations("your_workspace_id")
2. Attempt to execute each visualization:
Copy code
python    for visualization in visualizations:        try:            sdk.tables.for_visualization("your_workspace_id", visualization)        except Exception:            print(f"Visualization {visualization.title} is broken.")
If the visualization is broken (e.g., due to missing fields, broken metrics, or LDM changes), the SDK will raise an exception when you try to compute it. You can use this to flag or log broken visualizations automatically [Python SDK docs](https://www.gooddata.com/docs/python-sdk/latest/) [Python SDK for_visualization example](https://www.gooddata.com/docs/python-sdk/latest/workspace-content/workspace-content/for_visualization/). What about the JSON? There is no explicit property in the visualization JSON that marks it as broken. The only way to know is by attempting to execute it and catching errors. The SDK abstracts this for you—if the visualization cannot be computed, it will fail at runtime. VS Code Extension: The VS Code extension can perform referential validation, which checks for broken references (e.g., missing datasets, attributes, or metrics) in your workspace definitions. This is a manual or semi-automated process and does not provide a JSON flag either, but it can help you catch issues before deploying changes [Community Slack - referential validation](https://gooddataconnect.slack.com/archives/C04S1MSLEAW/p1714128145139339?thread_ts=1714128145.139339&cid=C04S1MSLEAW). Summary: - The SDK approach relies on catching exceptions during execution. - There is no JSON property that directly indicates a visualization is broken. - The VS Code extension helps with referential validation but does not provide a programmatic JSON flag. If you need to automate this, the SDK method above is the best available option right now.