Hi!

I have a query with a parameter (test).
I try to use the API, but I have a error message :

http://.../api/queries/6/results.csv?api_key=*****&p_test=123456

{"message": "No cached result found for this query. You have requested this URI [/api/queries/6/results.csv] but did you mean /api/queries/<query_id>/results or /api/query_results or /api/queries/<query_id>/refresh ?"}

Maybe I’m using the API not correctly?
I use the the self-hosted version (v7 on DigitalOcean).

(If I remove the parameters, it’s work fine!)

Thanks

Queries with parameters take a couple steps to fetch from the API. Here’s a link to the last time this came up:

Thanks for your response.
I’m not sur this solution work for me.

I use the API with the IMPORTDATA function of Google Sheets. So i can’t use POST but only GET.

Maybe it’s not possible only with GET request ?

Sorry it’s taken me this long to respond here. It bumped the bottom of my notifications.

I think you can still make this work, but you won’t be able to change the parameter values from Google sheets. If the query last ran with param=1, then you can GET the latest data from /api/queries/<query_id>/results so long as your GET request includes a body like so:

[EDIT 5 Jan 2021]: I was speculating when I wrote this. After some experimentation it won’t work because the /results endpoint requires a POST method if the query uses parameters (see this code).

{
  "parameters": [
    {
      "param": 1
    }
  ]
}