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 in to the ExtraHop system 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: | After you click Send Request, 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 extrahop.example.com and then changes the owner for all of those dashboards to the user account paulanderson.
#!/usr/bin/python3 import http.client import json HOST = 'extrahop.example.com' APIKEY = '123456789abcdefghijklmnop' headers = {'Accept': 'application/json', 'Authorization': 'ExtraHop apikey=%s' % APIKEY} conn = http.client.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()
Note: | If the script returns an error message that the SSL
certificate verification failed, make sure that a trusted certificate has
been added to your ExtraHop system. Alternatively, you can add the context
option and send the request over TLSv1.2 to bypass certificate verification. However,
this method is not secure and is not recommended. The following code creates an HTTP
connection over
TLSv1.2:conn = httplib.HTTPSConnection(HOST, context=ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)) |
Thank you for your feedback. Can we contact you to ask follow up questions?