Query datasource via http api gives 400 error

Hi All,
We are trying to query datasource via api. Following the documentation -

Getting below error :

“results”: {
“A”: {
“error”: “bad_data: 1:1: parse error: no expression found in input”,
“status”: 500,

Curl command below -

curl --location --request POST ‘https:///api/ds/query’
–header ‘Content-Type: application/json’
–header ‘Accept: application/json’
–header ‘Authorization: Bearer <>’
–data-raw ‘{

Grafana version - 9.5.3
Datasource: Prometheus

hi All,

Any help on above issue will be appreciated. we would like to get dashboard data via api to run some tests.
however the api requests are not working. Anybody who has got it working?