REST Protocol
Connecting and providing RESTful Web Services
With the REST protocol different systems can be connected to the REST interface. It works on pure web technologies and on a stateless logic basis for querying and editing data in systems. It is used in many modern application platforms that allow access and data exchange for external systems via the REST interface.
The OPC Router can access and query REST WebServices. So almost any system using REST API can connect, allowing it to retrieve or transfer data from these systems. The OPC Router can also act as a REST server via the REST trigger and provide REST functions for calling. This allows you to set up your own REST API for any systems that are connected with the available plug-ins.
Our tutorial video explains how to integrate OPC Router into your REST communication.
New: Step by step instructions
Using the example of weather data from OpenWeatherMap we show the REST Plug-in in action. Here we show how data can be exchanged with the Talk2M cloud via REST and how to send notifications and alerts from the automation layer for mobile users via SMS and as a WhatsApp message. Read more and learn everything you need to know about connecting ThingWorx via REST Plug-in or sending data to Power BI / Microsoft Fabric.
These and other customers rely on the OPC Router
That’s how easy it is.
REST connection via drag & drop
Connecting your systems via REST is very simple and intuitive with the OPC Router using drag & drop. This screenshot shows you an example of a connection of the OPC Router via REST to an SQL database. The goal of this example is to create a user administration via REST. For this purpose, master data from the database is transferred to the OPC Router and forwarded to the user administration with a REST API call for creation.
REST interface for OPC UA data
- Achieving more with coupled systems:
Via REST interface you can supply or obtain valuable data from any system. The number of systems with REST interface is constantly growing. - Industry 4.0 with REST:
With REST, systems offer a standardized open interface that allows simple networking. The OPC Router can thus easily integrate these into the networked production infrastructure. - About the OPC Router:
With the OPC Router you can graphically network your systems. Numerous Plug-ins make it a data hub in the industrial environment. Simple configuration, sophisticated monitoring and robustness characterize it.
REST Plug-in application examples
OPC UA data exchange between PLC and REST interface
Systems with REST interface allow you to modify your objects externally by calling REST functions. The objects can represent any entities, depending on which application the system implements. In addition to changes to objects, objects can also be created, queried, or deleted.
To create or modify objects using data from a PLC, the PLC can be connected via OPC UA and the OPC Client Plug-in. Which objects can be addressed in the target system can be queried and browsed via the OpenAPI / Swagger function by the OPC router. If, for example, a batch can be created via REST, the PLC must provide all data in OPC data points when the batch is created and trigger the REST call. The data points are then transferred as a JSON packet by REST call and the batch is created as an object.
Create OPC UA REST API for Zebra Printer
The OPC Router can also accept REST calls via the REST trigger. If several connections with respective REST triggers are created, a REST API / Web API is created. If, for example, a REST API is to be provided for a Zebra label printer to enable other systems to print via webhook (REST Call), a connection is created in which all print data is transferred to an OPC router REST trigger via REST Call. In the connection this data will be inserted into ZPL and sent directly to the Zebra printer with the Zebra Plug-in. In this way, the printer is abstracted and offered in the system structure as a REST Web Service.
Video tutorial: RESTful Plug-in
In this video we explain how to integrate OPC Router into your REST communication. In the first example we query weather data from OpenWeather. In the second example we show you how to configure and test a REST-ful interface on the OPC Router to read order data from a database.
Connecting Systems with the OPC Router REST Plug-in
Transfer-Objects
The REST protocol transfer object accesses the resource via endpoints, while the method used indicates allowed interactions.
Methods
The method is selected via any given endpoint path. The method can be determined by request parameters. The method result is generated as response. The data in the response field can have any desired format; and is often returned as XML or JSON.
The respective scope of various methods is often documented by Swagger. Call results in XML or JSON can be further processed via XPath and JPath Plug-ins.
Trigger
The REST Plug-in uses the standard trigger available in the OPC Router to prompt the transfers.
For direct connection triggering by external systems, the REST Plug-in provides an interface for calling REST functions in the OPC Router. Thus, the REST trigger serves as a direct call target. Parameters can be passed to the REST call which are used in the connection after the call.
Browsing
The methods of any given endpoint are read out via Swagger or OpenApi.
All methods are provided in a methods results list, made available as a list of all usable REST Service paths, for convenient selection. Various procedures are supported, among them: GET, PUT, POST und DELETE.