Renaming datasources with renaming in dashboards and panels

I’m going to need to rename some of the datasources in my various orgs - to make them unique prior to converting from Orgs to Teams in Grafana.

Am I correct in thinking that the only way to do this is to check the JSON in every single panel and make updates as needed - ie there’s no rename-datasource API endpoint that would handle the dashboard updating bit?

Obviously I don’t want to go coding my own tooling if there’s something out there already!

I think you can do it with the Grafana APIs.

You can update a data source: https://grafana.com/docs/grafana/latest/http_api/data_source/#update-an-existing-data-source

And you can update dashboards: https://grafana.com/docs/grafana/latest/http_api/dashboard/#create--update-dashboard

Thanks @dianapayton - but the key point was to have something that would automatically update any dashboard that relied on the renamed datasource. I’m guessing that I’ll have to link the various API’s with glue code, and have to scan all the dashboards.