API Key based data retrieval

1,440 views
Skip to first unread message

Chris McKeever

unread,
Oct 8, 2015, 9:46:55 AM10/8/15
to re:dash users
Ive seen a couple references to being able to have a remote script access the data via json/csv using the API KEY provided per report 
I havent found much concrete usage examples, any hints or links?

Im trying to have a remote script make the request and download result set that we can then use for hydrating a newsletter service 

Thanks in advance - Chris


Arik Fraimovich

unread,
Oct 8, 2015, 10:26:47 AM10/8/15
to Chris McKeever, re:dash users
Here's some info a sent to someone before (I really need to add this to the docs):

To explore the API you can append /api/ to most URLs, for example:

To get results for a query you can use the following:
Other resources have API access too, but I assume you need access to the queries. If you have something else in mind, let me know.

If you try the above in the browser, assuming you already logged in to the demo instance, it will just work.
To get it working from a script, you need to add an API key to the request (example: http://demo.redash.io/api/queries/4?api_key=60f0c7364ce547a49b0a297aa549c29bcfcf9db2). Each query has its own API key (which you can see if you click on the key icon in the query page), which lets you access this query and its results using the api. Also each user has an api key, which gives you access to all API resources (you can get yours by browsing to /users/me#apiKey).

API keys per user available from v0.6.3. And the UI to show them available from version 0.8.

Before v0.7 you had to sign requests rather than just add api key. You can enable api keys instead of signatures in older versions too, let me know if you need details.

-- 
Arik Fraimovich

--
You received this message because you are subscribed to the Google Groups "re:dash users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redash-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris McKeever

unread,
Oct 8, 2015, 10:50:57 AM10/8/15
to re:dash users, cgmck...@gmail.com, ar...@arikfr.com
Arik .. thanks so much.  This seems super straight forward and what I need

Yep - just need queries and accessing data.   Last question, can those request specify the data source?

Joey Simhon

unread,
Oct 9, 2015, 9:03:18 AM10/9/15
to re:dash users, cgmck...@gmail.com, ar...@arikfr.com
Hey Chris,

Since the request invokes a specific query, datasource is already defined as part of it.

I was working on a very lightweight Python client for re:dash API but didn't get around to complete it, will that help you in any way?

Cheers,
Joey

Chris McKeever

unread,
Oct 9, 2015, 10:00:17 AM10/9/15
to re:dash users
Thanks Joey .. my python is pretty shakey. But thanks for the offer.  We have a bunch of rails and php tools that hooking into this API should be fairly straightforward.

Ill look at what you mentioned about the datasource being defined.  It looks like the way we have it currently is that there is a drop down that you can run the query against, and it doesnt appear that the key changes.  Maybe we havent set something up fully 

Arik Fraimovich

unread,
Oct 10, 2015, 5:16:45 AM10/10/15
to Chris McKeever, re:dash users
When you change the data source in the dropdown, it updates the query object. At any given time a query is associated with only one data source. 
You can make a fork of it, that will run on another data source.

-- 
Arik Fraimovich

Chris McKeever

unread,
Oct 16, 2015, 3:37:57 PM10/16/15
to Arik Fraimovich, re:dash users
Arik - one last question!  Is there a way to pass URL parameters into a saved SQL query ?ie, run a specific query with parameter based dates ?

Arik Fraimovich

unread,
Oct 16, 2015, 4:10:30 PM10/16/15
to Chris McKeever, re:dash users
While there is basic support for query parameters (see: http://demo.redash.io/queries/146/source?p_action=create), it's not available via the API.

-- 
Arik Fraimovich
Reply all
Reply to author
Forward
0 new messages