Commonsense client API
This module is under heavy development.
Retrieve information from the CommonSense platform, using asynchronous http(s) calls.
This module works for both Node.js as just in the browser. In the browser it depends upon the native
XMLHttpRequest (or ancient
IE ≤ 6) object. When used in Node.js, it uses the node-XMLHttpRequest package.
Commonsense-node is available in NPM:
npm install commonsense
To include it in your node project, add
"commonsense" to your
bower install commonsense
This library can be used within a Node.js application and in the browser.
When available in your project, the following is a typical beginning of a usecase.
sense =username = 'some_username'password = 'md5_of_password'sensecreateSession usernamepasswordsensedevicesconsolelog 'Devices:'responseobject
This is a list of public example projects which use this library:
- Secare (GitHub repo): An online segmentation tool for data from the CommonSense platform.
- Sense Power (GitHub repo): Model-Predictive-Control (MPC) of electronic devices hooked up to the CommonSense platform.
The following api calls on the Sense object are implemented.
The calls follow the REST-style with the verbs (create, update, delete) prefixed.
An index (list) action corresponds with the plural form and a single get with the single form.
The callback is of the form
data argument is an optional object of headers.
# H E L P E R M E T H O D S #:# A U T H E N T I C A T I O N #::# D A T A P R O C E S S O R S #:::::# D A T A P R O C E S S O R S & F I L E S #:::::# D E V I C E S #:::# E N V I R O N M E N T S ## TODO: implement subenvironments:::::# E N V I R O N M E N T S & S E N S O R S #:::# G R O U P S #::::::# G R O U P S & U S E R S #:::::# G R O U P S & S E N S O R S #:::# S E N S O R S #:::::::# S E N S O R S & D A T A #::::# S E N S O R S & E N V I R O N M E N T S #:# S E N S O R S & D E V I C E S #:::# S E N S O R S & S E R V I C E S #:::::::::# M E T A T A G S #:::::# U S E R S #::::::
See the changelog for details of changes.
To test the library, please modify
test/api_urls.coffee by providing your username and md5 password. Please rememeber to remove these before a commit.
npm test from the commandline to run the tests.
- Fork this repository
- Clone it on your local machine
- Install developer dependencies:
- Create a topic branch:
git checkout -d feature
- Make your changes
- Verify that your changes do not break anything:
- Add tests if you introduced new functionality in
- Push your changes to your fork:
git push -u [YOUR_FORK] feature
- Open a pull request describing your changes: