How to pass parameter of date variable type in API


I am using metabase APIs for getting data from metabase question. My question has the SQL parameters. t1 and t2.

select * from totalcalls where starttime between {{t1}} and {{t2}}

t1 and t2 have their type as Date.

I am using the below query to get the data from the metabase.

[{“type”:“date”,“target”:[“variable”,[“template-tag”,“t1”]], “value”: “05-01-2020”},{“type”:“date”,“target”:[“variable”,[“template-tag”,“t2”]], “value”:“05-10-2020”}]

When I send this POST request I get the error “Unable to substitute parameters”,

Please tell me what is the correct way to pass the date type parameters?

I use dictionaries in C#, so don’t have to worry about the date format, but until someone who knows more comes along, try ‘YYYY-MM-DD’

Hi @vk9
The best way to learn the API, is to just use Metabase while having your browser developer Network-tab open and looking at the request, and what data is being send/received.
It should look like this:


Thanks flamber,

It worked for me.