API method to get dashboard and it's filter settings from URL

Is there a way to retrieve all information about a dashboard via API but using the URL? It seems like most of the Dashboard related API method only take {dashboard_id} as an argument, but that loads in dashboard without any filters applied. Is there an API method to take a URL instead of just dashboard_id and parse the URL to obtain filter information?

Sort of like getting information about a single explore query by providing the slug.

What are you trying to achieve - why do you need the filter information? There are ways of getting the filter information from the API i.e. I have a script that shows me all the query tiles for a dashboard ID, and returns a column for dashboard-level filters that exist, and another column for tile-level filters. I have another script that shows me what filter selections end users have actually selected when they executed the dashboard. So it’s possible to get really granular information on filters.

I’ve always thought of dashboards – and the tiles – as a gallery of metrics and even documentation about how to use explores. And I think it’d be cool for services that need metrics to get them from dashboards for that reason.

The thing is that to do that you often also need to be able to apply dash filter before “downloading” a tile. Right now there isn’t an easy way to do that. You can get a tile’s query info but it’ll be without any filters applied.

Apparently other people have asked this question in the past and never really got an answer and it also doesn’t seem currently possible looking at API Explorer.

I had to create some custom code to handle by taking following steps to download results of a tile in a dashboard with dash filters applied

  1. create funcs to parse a looker dashboard url and extract dash id and dash filters+values
  2. using filter names from url, find equivalent dashboard_filter
  3. get tile id of interest
  4. get query object of tile
  5. update query

Sorry, I still don’t understand your use case, and why it’s not possible using the API. From your reply, it sounds like you want to get the default dashboard filters that have been applied to a dashboard, and then run / download a query that applies those filters to a query.

Here is the Python script I use to extract all the filters applied to the tiles in a specific dashboard. It shows how you can get dashboard-level filters via the API:

import os
import pandas as pd

from looker_sdk import init40
config_path = os.path.expanduser("~/python/looker.ini") # this should point to where you have saved your Looker API credentials
sdk = init40(config_file=config_path)

### --- FETCH DASHBOARD --- ###
dashboard_id_to_fetch = '1158'  # Replace with your dashboard ID

# Fetch specified dashboard and store in a variable
print(f"➡️ Fetching dashboard {dashboard_id_to_fetch}...")
dashboard_full = sdk.dashboard(str(dashboard_id_to_fetch))
dashboard_elements = dashboard_full.dashboard_elements or []

# Create a list to store the dashboard elements data
dashboard_visualisations_data = []

# Loop through each dashboard tile, and append the details for each tile to the list
print("➡️ Fetching metadata and query details for each dashboard tile...")
for element in dashboard_elements:
    if element.type != "vis":
        continue # excludes non-query tiles 
    
    # Get the visualisation type (works for user-defined and LookML dashboards)
    vis_type = None # assigns a default value in case the 'if' condition fails
    if element.result_maker and element.result_maker.vis_config:
        vis_type = element.result_maker.vis_config.get("type") # only grabs vis type if the tile has one (to avoid errors)
        
    # Get dashboard-level filters, and return only the field names (works for user-defined and LookML dashboards)
    dashboard_level_filters_full_string = element.result_maker.filterables
    dashboard_level_filters = []

    for filtered_field in dashboard_level_filters_full_string:
        for listen_item in getattr(filtered_field, "listen", []):
            field_name = getattr(listen_item, "field", None)
            if field_name:
                dashboard_level_filters.append(field_name)
    
    # Get other visualisation details
    if element.query: # gets info for user-defined dashboards
        model_name = element.query.model
        explore_name = element.query.view
        filters = element.query.filters if element.query.filters else element.query.filter_expression
        fields = element.query.fields
        custom_fields = element.query.dynamic_fields
        short_url = element.query.share_url
    elif element.result_maker and element.result_maker.query: # gets info for LookML dashboards (element.query does not exist)
        model_name = element.result_maker.query.model
        explore_name = element.result_maker.query.view
        fields = element.result_maker.query.fields
        filters = element.result_maker.query.filters if element.result_maker.query.filters else element.result_maker.query.filter_expression
        custom_fields = element.result_maker.query.dynamic_fields
        short_url = element.result_maker.query.share_url
        
    dashboard_visualisations_data.append({ 
        "dashboard_id": dashboard_full.id,
        "dashboard_title": dashboard_full.title,
        "dashboard_level_filters": dashboard_level_filters,
        "visualisation_id": element.id,
        "visualisation_title": element.title,
        "visualisation_type": vis_type,
        "model": model_name,
        "explore": explore_name,
        "filters": filters,
        "fields": fields,
        "custom_fields": custom_fields,
        "short_url": short_url
    })

# Convert to a DataFrame for easy CSV export
df = pd.DataFrame(dashboard_visualisations_data)

# Output the DataFrame to a CSV file
print("💾 Exporting to CSV...")
output_path = "/Users/yourname/Python/outputs/get_tile_level_metadata_for_a_dashboard.csv" # Change this path as needed
df.to_csv(output_path, index=False)

print(f"✅ Results exported to: {output_path}")

(Note: I am not a Python expert. I cobble together stuff that does the job. So I’m sure there are neater, more concise ways of writing this code.)