Universal Cloud Adapter Cloud Adapter protocols
REST to Cloud

Transfer JSON data to the Cloud 

More and more devices are offering a generic JSON API instead of the classic industrial protocols. This makes it easy to collect measured values, statuses and consumption information in the local network and then transfer them to the cloud.

For the cloud connection, the software module Universal Cloud Adapter is required. The Cloud Adapter can be installed on any Windows or Linux device (x86, x64 or ARM). The setup is explained in “Getting Started“. Alternatively, you can also use the AnyViz IoT Gateway.

JSON-API Topology

The Universal Cloud Adapter is connected to the remote stations via a network connection and cyclically queries the measured values via a GET request, which are returned in the form of a JSON document. All properties are then available in AnyViz for further use.

JSON-Api Cloud Functionality

The API can be configured not only via HTTP and HTTPS. It is also possible to specify the path to a local script (e.g. shell or Python). This means that the JSON API can also be used to implement individual connections. The only requirement is that a valid JSON document is returned and that its structure remains constant.

Tip: Read out system load via JSON API

As an example of an individual script, the following content can be stored as getSystemInfo.sh on the Linux system of the Cloud Adapter. The absolute path to the file can then be specified under “URL/Path” in order to be able to monitor the CPU utilization and memory consumption of the operating system in AnyViz.

#!/bin/bash get_cpu_usage() { top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}' } get_memory_usage() { free | awk '/Mem/{printf "%.2f", $3/$2*100}' } create_json() { cpu_usage=$(get_cpu_usage) memory_usage=$(get_memory_usage) echo "{\"cpu_usage\": $cpu_usage, \"memory_usage\": $memory_usage}" } create_json