Refresh API with date range parameter


#1

Good evening,

I’ve been trying to refresh a query using the api and I’m encountering some issues with it.
I’m using the code example provided here by arik: https://gist.github.com/arikfr/e3e434d8cfd7f331d499ccf351abbff9

If I use a normal text parameter it works like a charm
http://some.redash.url/api/queries/query_id/refresh?p_hello=world

But if I try the new date range parameters it returns nothing
http://some.redash.url/api/queries/query_id/refresh?p_Rango.start=2018-12-01&p_Rango.end=2019-01-01

Is there a way to make it work?

Cheers,
Fran


#2

What version of Redash are you using?


#3

Redash 6.0.0+b8536 (4780bd9c)


#4

This was fixed in master and will be part of the next release.


#5

Awesome, thanks for the help arik :slight_smile:

How will the call be with the range parameter then? Like this?
http://some.redash.url/api/queries/query_id/refresh?p_Rango.start=2018-12-01&p_Rango.end=2019-01-01


#6

Fran,

The /api/queries/:query_id/refresh endpoint will soon be deprecated. A newer API is available, which offers better security and could be shared easily. You can use this API by submitting a POST to /api/queries/:query_id/results. Query parameters should be passed as “parameters” in the request body.

So in your case, it would be:

POST http://some.redash.url/api/queries/123/results
Body:

  "Rango": {
    "start": "2018-12-01",
    "end": "2019-01-01"
  }
}

Please keep in mind that this API is currently available on master only, and will be part of the next release (7.0.0).

Let me know if there’s anything else I can help with,
rauchy


#7

Thanks rauchy! is there any documentation for this new API?
If the /refresh endpoint won’t be a thing anymore, will there be a way to query for fresh results instead of the cached ones?

Best