Using the RescueTime Embed and Data APIPosted: September 14, 2009
share team status, show off top performers, and more
We’ve had substantial user interest in ways of sharing and re-using their RescueTime data. True to our principles of keep-it-simple, we’ve published a way to very easily and safely share views of your data. These features have been live for over a month now, and some of you have already found and done great things with them– thank you! Here I’d thought I’d outline the process and some example use cases to help undertand how you can take your data further.
Although sharing common underlying code, there are two different paths to API data, with two different intentions: embedding charts and raw data access.
Path 1: Super Easy! Embed a Chart
As you use our new, improved, faster, more flexible reports browser, when you come across a slicing and dicing you particularly like, just click the Embed button, found right under the chart. Grab the snippet, and stick it in your blog, or your intranet, or wherever you want to publish it. Note that you can put as many as you like on the same page. Some of our clients have built team dashboards on their corporate intranets where anyone can go to see the pulse of the organization. Some publish these on their websites to show off their performance. Some live blog examples include: www.tonywright.com, Chris Barrow’s Blog, TheG2.net Blog and node.to.
Behind the scenes, this sets up an access key for you and sets privileges on it: when you paste this snippet onto your blog or intranet, anyone trying to steal your info using this key can only get exactly what it already shows. Note that in the snippet you can tweak certain aspects of the chart.
Also note that while your report view in your browser is fixed to the date you are looking at it, your embedded chart will continue to update with whatever is current. The timeframe is saved– as in “a week” or “a day” but not the specific date.
Path 2: Get Funky With Your Data
The first step is to go to the “Embeds & Data API” link from the bottom of your logged in session. From there you can “Setup Data API” to create a key for raw data access. Instead of output being formatted for charts, instead you pick JSON or CSV output, which you can then parse and reformat however you please. You can also parameterize your requests to change what is returned, without needing new keys– you can change date, search key words, specific application names, among other things.
There is a security model around the key providing data scope control and access safety, based on the same key system used by embedding. In this case, a switch is flipped that allows parameterization– so it removes that “can only see what browse view saw” restriction that embed has. It is assumed you will keep these more privileged keys private. But you can always monitor traffic and disable a key if you believe someone is using it who shouldn’t be. You can also set basic network restrictions around the key, to lock it down to access for just your machines.
A Reference Implementation
You can see what we did with the API in our reference implementation hosted on Google’s Appengine. It uses all the aboved methods and API tools in one page. All of the code for it is available for download.