Technologies

Web Thing API as a language to define Digital Twins

Web Thing API is Mozilla’s proposal to describe a common data model and API for the “Web of Things”.

It is made of (1) the Web Thing Description which provides a vocabulary for describing physical devices connected to the Internet in a JSON encoded format, and (2)(2) Web Thing REST API and Web Thing WebSocket API which allow a web client to access the properties of a device, execute actions on that device, and subscribe to events that represent a change in its state.


The specification includes:

Next we can see the “Thing Description” of a device with different sensors and events:

We can see that the device (Digital Twin) has a property temperature, another one that’s humidity and another one that’s led, as well as an action (that someone can execute on the device) and an event (that is published when it is triggered) called reboot, as well as links to access the properties, actions, events,…

Following the specification we can see how:

Running this request:

I get the description of the specific device.

If I do:

It will return the value of the property:

If I want to change the value of a property I will execute:

If I want to launch a reboot action:

I can also get a list of action requests:

To access the events:

One of the advantages of this specification is its simplicity and that it is easy to implement both on powerful devices and on devices with limited resources.

The last draft is from May 25th, 2022. You can check the status from the Mozilla IoT website.

✍🏻 Author(s)

Leave a Reply

Your email address will not be published. Required fields are marked *