Change a dashboard owner through the REST API
Dashboards are owned by the logged in user that created them. If a user is no longer with your company, you might need to change the owner of the dashboard to maintain that dashboard.
To transfer ownership of a dashboard, you need the dashboard ID and the username of the dashboard owner. You can only view the username of the owner of a dashboard through the REST API.
Before you begin
- You must log into the ExtraHop appliance with an account that has unlimited privileges to generate an API key.
- You must have a valid API key to make changes through the REST API and complete the procedures below. (See Generate an API key.)
- Familiarize yourself with the ExtraHop REST API Guide to learn how to navigate the ExtraHop REST API Explorer.
Change the dashboard owner
Tip: | If you want to permanently delete the dashboard, instead of changing the owner, click DELETE /dashboards/{id}, type the value in the id field, and then click Try it out!. |
Tip: | After you click Try it out!, the REST API Explorer provides scripts for the operation in Curl, Python 2.7, or Ruby. |
Python Script Example
The following example script searches for all dashboards owned by the user account marksmith on an ExtraHop appliance with the hostname example.extrahop.com and then changes the owner for all of those dashboards to the user account paulanderson.
import httplib import json HOST = 'example.extrahop.com' APIKEY = 'f6876657888a7c1f24ac77827' headers = {'Accept': 'application/json', 'Authorization': 'ExtraHop apikey=%s' % APIKEY} conn = httplib.HTTPSConnection(HOST) conn.request('GET', '/api/v1/dashboards', headers=headers) resp = conn.getresponse() parsed_resp = json.loads(resp.read()) for dashboard in parsed_resp: if dashboard['owner'] == 'marksmith': print('Dashboard {id} owned by marksmith.' ' Switching ownership...'.format(id=dashboard['id'])) config = {'owner': 'paulanderson'} conn.request('PATCH', '/api/v1/dashboards/{id}'.format( id=dashboard['id']), json.dumps(config), headers=headers) resp = conn.getresponse() resp.read()
Thank you for your feedback. Can we contact you to ask follow up questions?