How to get Panel data from API

  • What Grafana version and what operating system are you using?
  • What are you trying to achieve?
    Extract panel data from existing dashboard.
  • How are you trying to achieve it?
    Creating a script using Python to update dashboards. I have found that when I try with my current script the panels on the existing dashboard are removed. I would like to add the panel data by using the GET api/dashboards/uid/ and then add it to my POST.
  • What happened?
    I receive an error “Error in configuring grafana, error is: ‘panels’”
    This happens with the bolded section below. Not sure what I am doing wrong.

'Use the GET api to get all the dashboard data. This works. dashboard_uid and dashboard_id have the right data, but dashboard_panels does not populate and throws an error.

dashboard_data = get_dashboardid(base_url, grafana_token, folder_id, page)
dashboard_uid = dashboard_data[0][‘uid’]
dashboard_id = dashboard_data[0][‘id’]
dashboard_panels = dashboard_data[0][‘panels’]

  • What did you expect to happen?
    I expected that dashboard_panels would have the panel information from the existing dashboard.