Executing query without max_age key

hey I am makig a POST request to the below api to execute a query and get results.

https://{my-domain}/api/queries/{query-id}/results?api_key={my-api-key}.

As per the documentation when I dont pass in the max_age key to the API request, the api should ideally start a new execution task and return me the execution job id. which i can futher pass to the API /api/jobs/<job_id>.

However, making the first POST request to /api/queries/{query-id}/results the Redash API without the max_age key, I directly get the query results almost instantly. As per the documentation i believe it should return me with an execution job id.

Is there any thing I am missing inorder to get the execution jobid ?

I think you have it reversed. The api tries to return a cached result unless you explicitly pass max_age=0.

I had the same issue. I already POST to https://{my-domain}/api/queries/{query-id}/results?max_age=0 and still get the cached result everytime

It belongs in the body of your HTTP request, not the query string.

yes, you need to send the parameter in the body and not in the query string itself.

hey @k4s1m, can we change the text of the api user guide?

" If max_age is omitted or 0 a new execution will begin and a query execution task (job) will be returned"

it says if we omit the max_age parameter in the request a new task id will be returned, but actually the api does require us to pass in max_age=0 for it to return task id.

also, my query is answered. we can mark this as solved.

1 Like