Hi,
I'd like to get the results from a Metabase question (that has a required filter) using the API. This is a test question with only 1 filter (a simple limit on the number of results).
I use the api post api/card/query from the official documentation and adapted it for Node.js.
I've found thanks to the Google Chrome DevTools that the parameters in the query are {"type":"category","value":"3","target":["variable",["template-tag","limit"]]}]}.
So, here is my code:
let param = '[{"ignore_cache":false,"parameters":[{"type":"category","value":"3","target":["variable",["template-tag","limit"]]}]}]'; // need to add '[' + ']' and convert in string
let encoded = encodeURI(param); // encode the parameter
response = await got.post("https://OUR_METABASE.com/api/card/" + "QUESTION_ID" + "/query/json?parameters=" + encoded,
{
responseType:"json",
headers:headers,
}
)
But I get error_type: 'invalid-query' + Input to substitute-native-parameters__8 does not match schema. I don't know what I'm doing wrong here.
Do you have an idea where the problem is coming from ?
Thanks in advance,
Regards,
Louis