Consider adding a resource handler to your data source. This essentially extends the Grafana REST API with a custom route for your data source that will be available to any panel.
Check out the post on How to add a resource handler for your data source for more information.