About ARM’s IoT platform

ARM’s mbed IoT platform is a cloud platform to develop Internet of Things applications and embedded devices. The platform exposes multiple interesting tools and services, such as notably device management or device connectivity via its mbed Device Connector service, which allows connecting IoT devices to the cloud platform. Using ARM’s device connector and ARM’s mbed Client, devices operated by ARM’s mbed OS become reachable through REST APIs calls using the Device Connector service’s APIs.

Using Scriptr.io for orchestration, data transformation and interoperability

ARM’s IoT platform provides full support for over 100 mbed-enabled boards and development tools that make it an excellent choice for implementing applications residing on the devices. However, the platform does not currently support the deployment and execution of back-end logic on the cloud, which is something that is also required by large scale enterprise IoT applications. These involve complex business logic that span multiple devices and services, with subsequent orchestration, data transformation and integration needs. In that case, it is important to leverage environments that provides such services, as for example scriptr.io, in combination with the features already provided by the ARM platform.

Device connector APIs as JavaScript objects in scripts

In order to get the best of both words, scriptr.io and ARM’s IoT platform, we wrapped the APIs exposed by ARM’s Device Connector in a bunch of JavaScript classes (our own connector), of which purpose is to expose aforementioned APIs to scriptr.io developers as first class JavaScript objects that can be easily invoked from within their scripts. In the below, we give a simple example on how to use the connector to read data from/write data to an mbed operated device.


  • You need to own an ARM mbed Device connector account
  • You need to have created an application on ARM’s platform in order to obtain an access key
  • You need to connect devices to your mbed Device connector account (you can real devices operated by ARM mbed OS or simulators)

Getting the connector
You can get the connector from Github.

Initializing the connector

The simplest way to initialize the connector is to create an instance of the DeviceServer class, passing your ARM access key:

var deviceserverModule = require("/arm/mbed/deviceserver");
var deviceServer = new deviceserverModule.DeviceServer({accessKey:"YOUR_ARM_ACCESS_KEY"});

Creating an endpoint

The Endpoint class of the connector is actually an abstraction of actual mbed endpoints (devices) and wrap all their corresponding APIs. In order to interact with an endpoint, you just need to obtain an instance of the Endpoint class, using the DirectoryService, as illustrated in the below example:

var deviceserverModule = require("/arm/mbed/deviceserver");
var directoryService = deviceServer.getDirectoryService(); // obtain a reference to the DirectoryService from the DeviceServer instance
var endpoint = directoryService.getEndpoint("/actuator/0"); // we assume that "/actuator/0" is the URI of our endpoint


Reading from an endpoint’s resource is actually an asynchronous operation (you do not get an immediate answer). Thus, reading is mainly about instructing the endpoint to send data to a callback, whenever possible. Therefore, you need to register a callback to the mbed Device Connector before starting to send read instructions to your endpoints (devices). A callback can be any HTTP API but you can use the default callback that is provided out of the box with our connector. Once the callback is registered, you can start reading data from your endpoint. Answers will be received by the callback whenever they are sent by the device.

var notificationService = deviceServer.getNotificationService(); // We need an instance of NotificationService to register a callback
notificationService.registerCallback({url:"https://yoursubdomain.scriptrapps.io/arm/mbed/api/callback"}); // register the default callback
endpoint.readFromResource("/speed"); // send a read instruction to the endpoint, asking to retrieve the value of the "speed" resource


Writing is pretty straightforward as well, you just need to specify the type of content you are sending:

// let's say we need to set the target speed
var writeParams = {
  resourcePath: "/speed",
  contentType: "text/plain",
  data: "45"


Our connector wraps most of ARM’s mbed Device Connector APIs so there are many more things you can do using our connector. Have a look at the available documentation and test script for more details.