Hi! I’m developing a form plugin for Grafana and have a question: what is the proper way to make requests to external APIs? Should I use the browser’s fetch method, or does Grafana provide specific functions for this purpose?
I will assume you are either building a data source or app plugin. You can use the regular browser fetch API but you’ll hit CORS limitations. You can also use the data proxy. Find the documentation here. Fetch data from frontend code using the data proxy | Grafana Plugin Tools
I also advice you to follow our tutorials they will answer most of the questions you will have regarding plugin development for Grafana.
No, I am developing a panel plugin. Is this different from others?
Panel plugins can only use the browser fetch API and are thus subjected to CORs limitations.
If you are trying to fetch data from a panel that would require something like the data proxy is likely you are approaching the problem incorrectly.
If that’s your case, maybe you can explain your idea and see what’s the best setup for you
@maxymzakharkiv Infinity Data Source can be used to make API calls in native Grafana way.
We explained it in the blog post for our Business Form panel, which may work for you: