Grafana Dashboard with Dynamic JSON Date Filters

I have a Grafana dashboard that retrieves JSON data from a URL. There is a filter appended to the URL that fetches data from the previous 14 days. However, the data in my table is static and only reflects the past 14 days. I want to have the ability to use the date filter in Grafana to choose data from the last 24 hours, 7 days, 30 days, etc. I am currently using the Infinity plugin. The format of my current URL is as follows:

https://myexamplapi.com/api?q='GROUP'="TEST-GROUP" AND 'Submit Date' >= ($DATE$ - ((60*60)*144))

you can use a variable to pass the date and time:

1 Like

I am still a little unclear on how to apply variables to my URL to make the default date filter work in Grafana. How would my URL look?

what is the date format you are passing in the url to the query?

the $DATE variable returns seconds.

epoch time seconds or just seconds?

just seconds

can you share the result of the query including submit date?

The result of the query is in JSON format, like this:

{ "entries": [ { "values": { "Request ID": "F08380778", "Submitter": "A345664", "Date": "2024-11-27T08:14:47.000+0000", "Service": "ABC Service" }, }, ], }