URLs with a range in dates different from dashboard

Hi, I am trying to use an url such as https://api.exemple.com/api/weather?startdate=20241212 with the infinity plugin, but I’m having trouble on the creation of the date. I tried the following:

Hi @aseques

Does your API URL specify both FROM and TO dates? Also, shouldn’t your URL box contain the URL which you are trying to query? Something like this?

Also, instead of ${__from:date:YYYYMMDD}, use ${__from:date:YYYY-MM-DD}

Hi @grant2 I need to use an api that gives me data for an interval that has to be in one of this two formats:

  • startdate=20241209&enddate=20241210 (so I’d need the day to be now+1d)
  • startdate=20241209 00:00:00&enddate=20241209 23:59:59 (staying on the same day)

At the end I went for the first method because you can’t get easily the format I needed (colons don’t work in this plugin, see here)
So the final logic is this one (using the __timeFrom and __timeTo will make use of the panel range dates (documentation)
startdate=${__timeFrom:date:YYYYMMDD}&enddate=${__timeTo:date:YYYYMMDD}

Some info that helped me was here and the final bit of information here

Have you solved your initial problem?

Yes, the last part has been to get a static time window in the future, I had to set the relative time to the future and the time shift to some value (1h in this case).


With this I’m finally finished with this.

Thanks for your help

URLs with date ranges different from a Grafana dashboard can be created through API requests or custom queries. For example, you can pass date ranges as parameters in the URL to fetch data from Grafana, like start={start_date}&end={end_date}. Additionally, services may generate static URLs for specific date ranges, such as https://yourservice.com/report?from=2023-01-01&to=2023-12-31. This approach allows for retrieving data outside the typical Grafana time picker, by directly embedding the date range in the URL.