Infinity API- Filter data for a specified time range


To filter the data for a chosen time range in Grafana, we need to pass the Grafana’s dynamic time range in the API URL. To do that, I am appending ?StartDate=${__from:date:YYYY-MM-DD} ${__from:date:HH}:${__from:date:mm}:${__from:date:ss}&EndDate=${__to:date:YYYY-MM-DD} ${__to:date:HH}:${__to:date:mm}:${__to:date:ss} to the url.

My full URL now becomes${__from:date:YYYY-MM-DD} ${__from:date:HH}:${__from:date:mm}:${__from:date:ss}&EndDate=${__to:date:YYYY-MM-DD} ${__to:date:HH}:${__to:date:mm}:${__to:date:ss}

But when I choose a timeframe of last 5 min on Grafana dashboard, the data doesn’t get filtered. Am I doing something wrong?