Publishing to external services

Yggio supports pushing device update data to external services.
There are two ways we achieve this, our own internal Publisher and NGSI subscriptions. They function similarly, but there are some significant differences. The main differences are support for MQTT and the format of the published data.

NGSI subscriptions

Documentation of NGSI subscriptions can be found here

Publisher

The publisher an internal service, sending data through either HTTP or MQTT.

To receive updates from an entity using the Publisher, you have to create a channel. The channel is a description of where updates to the iotnode should be sent. See the figure below.

channel

HTTP data will be sent through a POST request to the channel url.
MQTT data will be sent through the Yggio MQTT broker to the channel topic.

The request body will be of the following format:

{
  iotnode: Iotnode,
  diff: Object,
  event: Object
}

iotnode is the iotnode entity that has been updated.
diff contains the attributes that was changed in the update.
event contains the attributes that triggered the update.

Setting up a channel

Creating a channel is done by a simple POST request to our REST API, details can be found on Swagger.
Requirements for HTTP and MQTT channels differ and can be found below. Channels always require an iotnodeId and a name.

HTTP

Creating an HTTP channel also requires an url. The URL will not be changed in any way in Yggio, so make sure it matches your server exactly. This means including http/https if required. Updates for the iotnode will be POSTed to the URL with header content-type: application/json i.e. it will be POSTed as JSON.

MQTT

Creating a MQTT channel requires a type. You have the option to choose between keycloakUser or basicCredentialsSet as type. Yggio hosts its' own broker, and publishes iotnode updates to user- or client-specific topics. It's still required to create a channel in order to see the updates. For information on how to connect, please refer to please refer to MQTT (data consumer).