IotHttpSamples

Each sample is provided as a separate PLC project. The following table shows a list of the available samples:

Sample

Short description

PostmanEcho

Postman Echo is a test web service for REST clients. There are samples for HTTP GET, HTTP POST and HTPP PUT. There is also another HTTP GET sample with header authentication.

OpenWeatherMap

OpenWeatherMap is a REST API for querying weather data. In the sample, weather data is queried via HTTP GET in JSON format.

Philips Hue

Philips Hue is a smart home solution with a REST API. In the sample, values for a Hue lamp are changed using HTTP PUT.

Telegram

Telegram is a messenger with a REST API. In the sample, messages are sent from TwinCAT to a Telegram user via a so-called Telegram bot.

AWS IoT

AWS IoT is the cloud service from Amazon Web Services. The sample shows an HTTP GET to an AWS IoT Shadow and an HTTP POST to the AWS IoT Core Message Broker.

AWS Service Configuration

It is also possible to access various AWS services via HTTP. In this sample, an AWS service is accessed via HTTP GET.

Sample code and configurations for this product can be obtained from the corresponding repository on GitHub: https://github.com/Beckhoff/TF6760_Samples. There you have the option to clone the repository or download a ZIP file containing the sample.

IotHttpSamples 1:

PLC projects are divided into a MAIN part and various function blocks. HTTP command-specific functions (GET, POST, PUT) are encapsulated in the named function blocks, in order to keep the program uncluttered.

The MAIN part of each sample is used to configure the HTTP client function blocks. Once the client function blocks are configured, the various HTTP commands can be triggered from the MAIN part. The instantiated HTTP client function blocks are then passed through the various encapsulated function blocks.