When calling an API for a datasource plugin.
All the examples of calling an API just pass the whole query to params.
If i’m calling an existing API and need to customise my params how do I access the properties of the query eg startTime, endTime etc
query.endTime does not work and i’m not sure of how to access the properties inherited from DataQueryRequest or do I need to expose them somehow in MyQuery ??
eg
async doRequest(query: MyQuery) {
const globalParams = {
dateFrom: query.startTime * 1000,
dateTo: query.endTime * 1000,
frequency: 'raw',
};
const result = await getBackendSrv().datasourceRequest({
method: 'GET',
url: 'https://existing.api.url',
params: globalParams,
});
return result;
}