Infinity API call with Timestamp

Hello, I’m new here.
Anyway, I have a Grafana Dashboard, that shows me for example on the Geomap Panel the current traffic from the Cloudflare GraphQL API. This API is connected via the Infinity-datasource.
Here my question: Is there any way, to send a variable, that has the date of for example the last five days, so in the format “YYYY-MM-DD”? So in general, the current date minus five days. How can I do this?

Thanks for your help!

Welcome

You can use the grafana date time picker to get -5d parameter here
image

and then use it as a parameter

Hello yosiasz,

first of all, thank you for your answer.
But which values do I have to write in the boxes “Key” and “Value”?
And how can I add this variable in the “GraphQL query”?

Thank you so much for your help!

1 Like

No problem!

So this is what an api call with query parameters would look like

your_api?device=${deviceID}&StartDate={__from:date:YYYY-MM-DD}

so the keys in the above case would be

key,value
device:${deviceID}
StartDate:{__from:date:YYYY-MM-DD}

Read up docu about dates

It works!

The solution for me was:
I have added this “?StartDate={__from:date:YYYY-MM-DD}” (without quotation mark!) in my URL.
My body type contains the following: “${__from:date:YYYY-MM-DD}” (with quotation mark!)
The “URL Query Params”:
And my key is: StartDate
So the value is: __from:date:YYYY-MM-DD

Thank you very much!

1 Like