Good Day!
I am using grafan Json api plugin and I want to use time range diapason on this plugin in order to filter result by date
I know that we can use time range by $__timeFilter, $__timeFrom or $__timeTo, but how to use time range in terms of Json plugin, can anyone give some idea, please?
or can anyone suggest any other json plugin?
for example I used Infinity plugin but with that also could not manage to use time range
I was wondering the same thing this morning. If this is possible it’d be great to see an example.
1 Like
yes this plugin,
or can you suggest any onther json plugin that works with time range?
that should work. Can you please post your sample data?
well, I connot upload json file, this site is not letting me do so,
If you know the solution, can you please demonstrate it step by step?
[
{
“login”: “CALL1”,
“full_name”: “CALL1”,
“login_date”: “2022-11-28 17:44:24”,
“user_type”: “Dialog”
},
{
“login”: “CALL9”,
“full_name”: “CALL9”,
“login_date”: “2022-02-03 12:35:59”,
“user_type”: “Dialog”
},
{
“login”: “EMAIL”,
“full_name”: “EMAIL”,
“login_date”: “2021-02-03 18:04:10”,
“user_type”: “Service”
},
{
“login”: “CALL7”,
“full_name”: “CALL7”,
“login_date”: “2022-10-04 12:08:38”,
“user_type”: “Dialog”
},
{
“login”: “HISTORY_USER”,
“full_name”: “HISTORY_USER”,
“login_date”: “2021-02-22 17:13:07”,
“user_type”: “Service”
},
{
“login”: “MOBILE”,
“full_name”: “mobile”,
“login_date”: " 2022-10-04 08:24:22",
“user_type”: “Dialog”
},
{
“login”: “CALL5”,
“full_name”: “CALL5”,
“login_date”: “2022-12-04 18:57:23”,
“user_type”: “Dialog”
},
{
“login”: “CALL8”,
“full_name”: “CALL8”,
“login_date”: “2022-11-04 08:24:22”,
“user_type”: “Dialog”
},
{
“login”: “CALL6”,
“full_name”: “CALL6”,
“login_date”: “2022-11-04 09:14:45”,
“user_type”: “Dialog”
},
]
using jsonata
You can play with it as you want with your time range here
https://try.jsonata.org/pjT_VFos9
($f := $; $filter($f, function($v, $i, $a) { $v.login = "CALL5" }) )
and transform
thanks, but this is not working with grafana time range,
it would be better if it worked like this
1 Like
yosiasz
December 6, 2022, 7:08pm
11
are you sending these values to your api endpoint?
I too tried using the $__timeFrom such as below in a JSONata field:
That does not work. Hard coding a date value there does however.
Edit* Misread your reply a bit there. Sounds like you tried this as well.
yosiasz
December 6, 2022, 7:28pm
13
it is hard to test it in grafana. I would test things out over in https://try.jsonata.org/
Also are you dates UTC?
yosiasz
December 7, 2022, 7:25am
14
Are you asking about sending those values to your api as parameter or filtering the data from the api within grafana ?