Ninja Blocks API

/rest/v0

Home

Core Concepts

REST

Device Protocols

See Also

List of Device IDs

Forums

Code

Mailing List

Core Concepts

The first class citizen in the Ninja Platform are devices. Devices are things like temperature sensors, LED lights, SMS, and can even be services such as Twitter and Facebook (anything really). These things can sense, actuate, and in some cases both.

Devices talk to the Ninja Platform via a hub which we call a 'block'. Blocks are essentially just gateways between your devices and our platform. They handle authentication, configuration, and routing to and from your devices.

As a developer, after you have been authorized to access a user's device data, you will want to subscribe to this data. This is easily accomplished with callbacks (see here), a neat feature that allows you to register a URL against a device that we will POST to whenever data is received by that device. When working with callbacks as a third party application developer, we recommend requestb.in to assist with troubleshooting.

Devices have numerous properties, but a few you will see over and over again:

In some cases, you might have many things talking to 1 device, for example an RF module, or Blue Tooth dongle. In this case we allow for creating 'sub-devices'. Sub-devices can be either sensors or actuators, and essentially allow you to class data that might be sent/received by that device. For example, your RF module might report '101000001111101010000' when you press your door bell. Saving this value as a sensor sub-device allows the user a more human interaction. Depending on your application, you may never have to interact with sub-devices.

You can add web services as devices too, such as Twitter, Webhooks, Facebook, Email, Twilio, etc. The list can be found in your account page.