New Pachube Apps Facility

In the beginning (April 2011) there was a beta apps platform (announced at the hackathon) that allowed the creation of apps that other users could use with their datastreams.  This has now been superseded and a new facility is being tested prior to launch.  This is based on OAuth as the way of allowing a given app to use one’s data.

The new process for the user

  • Go to the app’s home page
  • Click on the install link
  • Authenticate at pachube
  • Configure the app, associating the user’s data feeds
  • App is now ready to use

How it works

The diagram shows a four step process for the user.  The grey boxes are the app and the white ones are pachube.  R shows redirects and dotted lines show server-server communication.

The pachube OAuth API spec shows how to implement this.  I did a version in PHP which took an hour or so to implement.  This is currently specific to my apps but I plan to generalise it in due course.  It’s not the whole solution because the configuration piece will tend to be app-specific.

Associating data to your app

This used to be handled by the pachube apps installer which is no more.  This is no great loss as the original UI, being generic, could cause user confusion.  Now that the developer can roll their own UI you can make it as useable as you like.

A first demo of this approach

Here’s an example.  After authenticating with pachube I take the user here where they can select the feeds and datastreams to use.  This needs explanations of course but the important feature is that both the app and the data semantics are visible together and clearly related.

Once the user confirms this configuration we can save it and take them straight to the app itself and set it running.  It this point there is no data store within pachube for the configuration.  Again, not a problem as you are free to store this wherever you like.

Limitations/ outlook/ suggestions

The current OAuth mechanism gives an app access to all the feeds belonging to the currently logged in user.  This is fine for now.  However, I foresee that users will have certain feeds and/or datastreams that need to be more private than that.  I understand that this is in the pipeline from pachube. It should be quite easy to retrofit this capability when the time comes if you cater for it in your design (each datastream will need to know what access the key provides);

Another issue is that each app needs to replicate the fields in pachube’s “App” entity (description, urls etc).  It would be useful if this could be accessible via an API so that the two could be sync’d (using the app owner’s master key).  Ideally, the app should be able to instantiate itself within pachube using an API rather than manually – this would avoid any accidental transcription errors.

The current (beta) versions of a couple of apps are at https://pachube.com/users/paul_tanner/apps.  I have asked how you get apps onto https://pachube.com/apps (ie more generally available).  No answer on that while the overall facility is still being completed.

Watch this space for more info as we test this more fully.