How do I get a list of dashboards that a user has access to via the API?

Knowledge Drop

Last tested: Dec 28, 2017
 

First, you will want to pull down the content_metadata_id and id fields from every dashboard using the all_dashboards endpoint. We don't need the other fields, so limiting to just those two helps save some time.

Be sure to grab the dashboard folder's content_metadata_id, rather than the dashboard's content_metadata_id. (Both are included in the response from the all_dashboards endpoint.) The content access information for dashboards (and Looks) is associated with the folder's content_metadata_id, since you manage content access at the folder-level. Using the dashboard's content_metadata_id will give you an empty result from the all_content_metadata_access endpoint you'll use next.

Next, use the all_content_metadata_access endpoint to pull down all of the content access information. Each content_metadata object has a list of group IDs that have access to the content represented by it. From there, you will want to map group_id to content_metadata_id to the dashboard id from the first step.

For a given user, you will want to find all of the content_metdata_id from all_content_metdata_access which give access to any group they are a part of, and then you will easily be able to list the dashboard IDs that correspond to them.

Alternate approach:

  1. As an admin, call login_as_user(user_id), passing in the id of the user in question. This will return an access_token that will run as the specified user.
  2. Call all_dashboards() using the access_token obtained above.
  3. Done! 🙂 As with all API functions, the responses are filtered to only return the data that the caller has permission to see.

This content is subject to limited support.                

Version history
Last update:
‎07-07-2021 01:51 PM
Updated by: