Friends, please tell me: how to write a request for updating the text in the panel?
I’ve tried different ways, but it doesn’t work. My code is below:
import requests
grafana_url = 'http://127.0.0.101:3000'
api_key = 'eyJrIjoiajBZNDZ'
dashboard_uid = 'lFu1yKN7z'
panel_id = 34
new_text = """
Smthng
"""
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
dashboard_response = requests.get(f'{grafana_url}/api/dashboards/uid/{dashboard_uid}', headers=headers)
dashboard_data = dashboard_response.json()
for panel in dashboard_data['dashboard']['panels']:
if panel['id'] == panel_id:
panel['options']['content'] = new_text