Representational State Transfer

What is REST?

REST is a software architectural style for web services and interfaces. Various online services and other applications use REST interfaces (REST APIs) to make information available externally. On this page, we explain the features and benefits of REST and show how communication via REST APIs works in practice.

Definition

What is REST?

Representational State Transfer (REST) is an architectural style for building web services and their interfaces (APIs). An interface developed according to the REST principles is called a REST API or RESTful API.

Since its conception in 2000, REST has been established as an important standard in the development of web services. REST defines how applications (REST clients) can access information from other systems through a REST API and retrieve or modify it.

Today, a wide variety of applications and services communicate via REST interfaces: From Google Maps, PayPal and streaming services to household and industrial appliances.

Explanation

How does REST communication work?

Communication via REST interfaces is based on the client-server principle. The server (web service or application) provides information (“resources”) in the form of a REST API. One or more clients can interact with the resources via the REST API and retrieve or change them.

In practice, the REST client and REST API communicate via the HTTP protocol. A REST API has a host URL that can be used to access it, just like a website.

A REST client makes an HTTP request to the REST API using its host URL (“API call”) and addresses a specific resource of the API. This is done using a Uniform Resource Identifier, or URI for short.

The HTTP method of a request determines how the addressed resource is to be interacted with. There are four basic methods:

  • GET: Requests a representation of the addressed resource.
  • POST: Changes the addressed resource or creates a new resource at the specified address.
  • PUT: Adds a new resource below the addressed resource.
  • DELETE: Deletes the addressed resource.

An example HTTP request to a REST API could look like this:

Example of a REST API call

In the example shown above, a GET request is used to retrieve information about a user with the ID 123. The REST API is also informed that the response should be in JSON format.

In many cases, requests to a REST API contain further parameters such as authentication keys.

In order to retrieve or change information via a REST API, a REST client must know the addresses (URIs) of the corresponding resources. REST APIs therefore need to have documentation that shows the interaction options. A REST API can also provide further documentation via a selected resource.

REST API communication for industrial production

With the cloud platform manubes, you are able to systematically automate production processes and visualize all areas of a production in real time.

In addition to industrial standard protocols such as OPC UA and MQTT, manubes also uses REST to communicate with online services, devices and other applications. Requests to REST APIs can be integrated into automated workflows, allowing users to efficiently manage their industrial data exchange.

The manubes platform offers worldwide access via web browser, easy operation and maximum security for production data.

Requirements

Core principles of REST – Requirements for REST APIs

For a web service to be considered REST-compliant or a web interface to be considered a REST API, they must fulfill various requirements. These requirements form the core principles of the REST architectural style.

Client-server structure:

A REST-compliant web service must be based on a client-server architecture. The client and server only communicate via the interface provided, with the client making requests to the server and addressing specific resources. One of the most important advantages of this model is scalability: the client-server separation means that servers can be expanded independently of the clients.

Statelessness:

Each individual request from a client to a REST API must be self-contained and receive all the information required to process the request. There is no management of client sessions by the server.

Caching:

The client and server must be able to cache resources received or provided in order to avoid unnecessary requests or provide resources more quickly.

Uniform interface:

The resources provided by the server must be uniformly addressable for all clients. In practice, a server provides URLs that clients can use to navigate the interface and retrieve resources.

On request, the server provides representations of resources with which a client can interact in order retrieve information or change the underlying resource.

Multi-layered:

With a REST API, only a standardized interface needs to be provided to the clients. All underlying layers remain hidden. This favors scalability and allows the flexible use of various systems and technologies, including firewalls, content delivery networks (CDN), load balancing and more.

Code on demand:

In contrast to the principles described above, the code on demand property is optional. This describes the ability of REST APIs to send executable code to REST clients when requested.

Advantages

What advantages does REST offer?

Interfaces that are built according to the REST principles are characterized by a high degree of flexibility, scalability and simplicity compared to other interface types.

REST makes use of common Internet technology, in particular the HTTP protocol and URLs/URIs for addressing the API and its resources. Integration into existing web infrastructures is therefore generally much easier. Many websites themselves already represent REST interfaces.

The resource orientation of REST, in which resources are identified via URIs and manipulated using standardized operations (HTTP methods), makes REST APIs comparatively easy for developers to understand.

Furthermore, REST APIs are easily scalable and compatible with many performance optimization technologies due to their statelessness and multi-layered nature: Because the client and server are decoupled from each other and requests to a REST API are self-contained, interfaces can be flexibly expanded.These changes are not visible to clients.

Last but not least, the REST architecture style is programming language-independent, as it is based on open standards and simple data formats such as JSON or XML. This promotes interoperability between different systems and is one of the main reasons why REST is so widely used today.

Discover manubes!

Cloud-based production management with manubes: Our innovative platform offers specialized tools for connecting production systems, managing and visualizing production data and automating production processes. manubes users benefit from a powerful infrastructure, worldwide access and maximum security.