API call with headers as datasource (API query runner)


#1

Hi guys,
Would some of you as well enjoy Redash being able to query various service providers that have a data query model accessbile through an API?
For those of you who use cloudflare (a customer of Redash) or other SAAS provider which have limited internal reporting capabilities, but a complete API to query data, this would make a huge difference.

How could that look like?
I would see a datasource called API, where you could set a base URL and Headers variables.
In the query part, it could be very simple and one would insert the missing part of the URL.

In the datasource part:
For cloudflare, I would have a base URL looking like this:
https://api.cloudflare.com/client/v4/
I would have a list of Headers keys one could add, in the cloudflare example:
header key: X-Auth-Email header value: blablabal@blabla.bla
header key: X-Auth-Key header value: 12345
header key: Content-Type value: application/json

In the query itself, I would simply paste what’s missing:
/zones/blablablablablablabla/analytics/dashboard?since=-800&continuous=true

This would result in a JSON response that should not be a problem for redash to render.
Therefor, the difficulty here will be to transform the results of such API calls into the expected “Columns” and “Rows” format in a dynamic way, acting as a converter that handles objects and nested documents.

Any interest?


#2

Huge interest on my side for this feature.
The URL type of Datasource is not compliant with secured API (with Oauth or Basic authentication).