Skip to main content

Wolfram Data Drop

Latest Version: 1.0.0

This library wraps the Wolfram Data Drop API. Wolfram Data Drop is an open service that makes it easy to accumulate data of any kind, from anywhere—setting it up for immediate computation, visualization, analysis, querying, or other operations.

You can view the library’s source code on GitHub. Click here to see information on the available versions of this library.

To include this library in your project, add

#require "WolframDataDrop.class.nut:1.0.0"

at the top of your agent code

Class Usage

Constructor: WolframDataDrop(binId)

To instantiate a new Wolfram Data Drop object, you will need the ID of your data drop ‘bin’ to pass into the constructor:

#require "WolframDataDrop.class.nut:1.0.0"

bin <- WolframDataDrop(binId);

Class Methods

sendEvent(data[, callback])

The sendEvent() method adds a new datapoint to your bin. If a callback function is supplied, the request will be made asynchronously and the callback will be executed upon completion. If no callback is supplied, the request will be made synchronously and the method will return a Squirrel table with three fields: statuscode, headers and body. The body is itself a table; it has two fields: err and data.

Examples of both uses of this method can be seen below:

// Asynchronous Request
device.on("temp", function(data) {
    local dataToSend = {
        "ts" : data.timestamp,
        "temp" : data.temp
    };

    // Send asynchronously
    bin.sendEvent(dataToSend, function(response) {
        server.log(response.statuscode + ": " + response.body);
    });
});
// Synchronous Request
device.on("temp", function(data) {
    local dataToSend = {
        "ts" : data.timestamp,
        "temp" : data.temp
    };

    // Send synchronously

    local response = bin.sendEvent(dataToSend);
    server.log(response.statuscode + ": " + response.body);
});

Release History

The Electric Imp Dev Center documents the latest version of the library. For past versions, please see the Electric Imp public GitHub repos listed below.

Version Source Code Notes
1.0.0 GitHub Initial release

License

The Wolfram Data Drop library is licensed under the MIT License.