Hello @sayantansingha9 ,
You may query external source with backendSrv.datasourceRequest() method.
import { getBackendSrv } from '@grafana/runtime';
let options: any = {
method,
url: "http://YOUR_API_URL_HERE"
};
if(method === 'GET' || method === 'DELETE') {
options.params = data;
} else {
options.data = data;
}
const response = await getBackendSrv().datasourceRequest(options);
const responseData = response.data;
I’m currently developing a datasource to take data from Loud ML server. You may look on github how to do requests: https://github.com/vsergeyev/loudml-grafana-app/blob/master/src/datasource/loudml_api.ts
@daniellee thank you a lot, your example with api/datasources/ helped me to get URL and username. I just wondering if there is a way to get all connection info. I’m developing a panel for ML. So when user creates a ML model panel sends a request to Loud ML server with info about source data to train model on.
Have a safe day,
V.