How can I add colleague with "own" or "manage" access to all my queries?

I’m taking on a new role in my team and want to give a colleague with own/manage access to all my queries and dashboard. I was doing this manually then got tired at the 5th query… is there an easy way to do this?

There isn’t a way to do this quickly from the interface at the moment. But it should be possible with the API. You will need to cycle through the query id’s and then hit the following endpoint:

/api/queries/[your_query_id]/acl

The request header will need to include your API token. And the request body should include the following data:

{
  "access_type": "modify",
  "user_id": [their_user_id]
}

A really simple example in Python would look like this:

import requests

redash_url = "Wherever Your Redash is hosted"
query_ids = [1, 2, 3, 4]
API_TOKEN = "token provided by Redash"
COLLEAGUE_USER_ID = "Whatever their user id is"
params = {'access_type': 'modify', 'user_id': COLLEAGUE_USER_ID }

s = requests.Session()
s.headers.update({'Authorization': 'Key {}'.format(API_TOKEN)})

for query in query_ids:
  response = s.post('{}/api/queries/{}/acl'.format(redash_url, query), json=params)

Update: I have confirmed this script will work with Redash v8.

1 Like