There is a bug in Discourse API when running Data Explorer queries containing parameters (both queries below work as expected when run from the browser).
Following the instructions from Run Data Explorer queries with the Discourse API and using
-F 'params={"group_id":"64"}'
to run this query (which has a parameter without its default value set)
-- [params]
-- int :group_id
select id, name from groups
where id = :group_id
results in an error: {"success":false,"errors":["DataExplorer::ValidationError: Missing parameter group_id of type int"]}
When a query has a parameter with its default value set, the API call is successful, but the result is the same regardless of the value provided via -F 'params=
-- [params]
-- int :group_id = 2
select id, name from groups
where id = :group_id
-F 'params={"group_id":"64"}'
and it always returns the result for the default value of the parameter: {"success":true,"errors":[],"duration":0.2,"result_count":1,"params":{},"columns":["id","name"],"default_limit":1000,"relations":{},"colrender":{},"rows":[[2,"moderators"]]}