Tuesday, March 26, 2013

SolarQuery web service API

I've recently been working on improving the interface for external applications that interact with and access data from the SolarNetwork.  Here is a quick update on where things are at.

SolarQuery is the SolarNetwork application that exposes web services for querying the data collected by SolarNodes. SolarQuery is what enables data visualizations like Consumption Monitor and Generation Monitor. This API is still being developed, but we've created a API Sampler page that demonstrates the latest API.

The sampler also demonstrates the SolarNetworkWS authorization scheme used by the web API. This scheme is modeled after Amazon's AWS scheme used by RESTful services like S3 and uses the HMAC-SHA1 hash scheme to authenticate and sign each request. Owners of SolarNodes can log into the SolarUser application to manage their nodes and create security tokens:

These tokens are then used by the SolarQuery web API, and the API Sampler page shows how to properly sign each request using the tokens (it uses the open-source crypto-js library to handle the HMAC encoding). The sampler also provides API method templates to quickly test different methods, and will show the results of the method call directly in the page:

After the web service API is expanded and has sufficiently stabilized, we'll create more complete documentation on the API.

Any feedback is appreciated.


No comments: