There are a number of ways to get data and data logs from the SmartServer IoT.
The SmartServer IoT Access Protocol (IAP) provides three APIs to get real-time data and data logs.
1. IAP/MQ is a publish-subscribe-based messaging protocol which provides the fastest way to get live data. IAP/MQ allows the SmartServer to push live data to a server
2. IAP/REST is commonly used to create interactive application that use Web services (HTTP or HTTPS). IAP/REST allows you to access the SmartServer CMS and is used to read and write datapoint values. The response to a GET request to read the a datapoint value has the cached value stored in the SmartServer database. IAP/REST can be used get data logs, but may be much slower than using WebSockets.
3. IAP/WS uses WebSockets for bi-directional traffic. WebSockets are used in two ways
- General purpose WebSockets can be used to get live datapoints updates faster than using IAP/REST alone. An IAP/REST ON-demand GET request can be sent to SmartServer to cause the SmartServer to read the current value of the datapoint and the datapoint value can be see immediately as a WebSocket update
- Data log WebSocket are used to get data logs from the SmartServer. Getting data logs with WebSockets is typically much faster than using IAP/REST.
To push data to the cloud customers use the built-in Node-RED (Sequence Widget) or create an IAP Internal Device using Node.js.
Many Cloud Providers have custom Node-RED node that you can use to push data to their servers. Use the MQTT in and MQTT out nodes to work with a lot of data at a time. The example below uses to MQTT in nodes, and two function nodes to filter out the desired datapoints and to reduce how often the data gets sent to the clould.