REST API explained simply
Imagine you send another system a question – for example: “Hey, please give me the current production status!” – and it promptly replies with the requested information. That is exactly what a REST API (Representational State Transfer) enables. Standard HTTP commands such as GET, POST, PUT or DELETE are executed – but machines talk directly to each other, without complicated effort. In the IIoTIIoT is the internet-based networking of industrial machines, systems, and devices for data collection and process optimization. world this means: your sensors or systems can communicate via the Internet in the same way you use a website today – straightforward, fast and efficient.
Background information
A REST API (also RESTful API) is a programming interface that follows the principles of the REST architectural style (Representational State Transfer). This style was defined by Roy Fielding in the year 2000 and offers flexibility, scalability, consistency and efficiency in web-based systems.
REST APIs in IIoT platforms
In IIoT platforms, devices, sensors, measurement data and time series are typically modelled as resources. Each resource receives its own URL, through which it can be uniquely identified – for example /devices/{deviceId} or /things/{id}. Communication takes place via common HTTP methods such as GET, PUT, POST, DELETE, with JSON used almost universally as the data format. This combination ensures interoperability – different systems and providers can communicate with each other without great effort.
REST APIs also offer clear advantages in the IIoT context:
- They are based on HTTP, run on almost any platform and require no special knowledge – many automation engineers already know HTTP.
- They reduce the need for gateways or protocol converters, since many systems can communicate directly via REST.
- Many platforms (e.g. from Bosch, Siemens, AWS, IBM Watson) use REST-like APIs, allowing applications to be developed and migrated independently of manufacturer.
REST/API principles in detail
REST is not a protocol, but an architectural style, defined by six central principles – called “constraints” – which together ensure that APIs are flexible, scalable and maintainable:
- Client-server
Clear separation between client (e.g. web interface or IIoT application) and server (API backend), which allows independent further development of both sides. - Statelessness
Each request contains all relevant information – the server remembers nothing from the previous state. This makes APIs scalable and tolerant of failures. - Cacheability
Responses can be clearly defined as cacheable or non-cacheable (e.g. via HTTP headers), which improves performance and reduces server load. - Uniform interface
A uniform interface via resource URIs and standardised HTTP methods.- Resources are represented by unique URIs.
- Manipulation takes place via representations (e.g. JSON) that contain all necessary information.
- Messages are self-descriptive – e.g. through headers and media types.
- Layered system
The architecture can contain several layers (client → gateway → server) without the client knowing how many or which layers exist in between. This increases security and scalability. - Code on demand (optional)
The server can deliver executable code to the client at runtime – for example in the form of UI scripts. This principle is optional and is rarely used.
Another advanced concept is HATEOAS (Hypermedia as the Engine of Application State): The server not only delivers data, but also links to further actions or resources. This way the client navigates dynamically through the application – without hard-coded URLs. As a result, the server can be further developed independently.
Further information and links
- Blog Pepperl+Fuchs – REST API as a key protocol in IIoT (Part 4 of a series)
https://blog.pepperl-fuchs.com/de/2024/vier-tcp-basierte-kommunikationsprotokolle-als-schluessel-fuer-das-iiot-teil-4-rest-api/ - Moxa Tech Note – RESTful API for connecting remote I/O devices in the IIoT environment
https://www.moxa.com/Moxa/media/PDIM/S100000327/moxa-iologik-e1200-series-using-a-restful-api-to-connect-to-remote-i-os-tech-note-v1.0.pdf - REST API Tutorial
https://restfulapi.net/rest-architectural-constraints/ - Principles of RESTful API Design
https://codesignal.com/learn/courses/ai-interviews-system-architecture-and-design/lessons/principles-of-restful-api-design - Test APIs – an overview of principles
https://blog.dreamfactory.com/rest-apis-an-overview-of-basic-principles
