{"id":21950,"date":"2023-11-30T10:08:52","date_gmt":"2023-11-30T09:08:52","guid":{"rendered":"https:\/\/www.teamnext.de\/blog\/what-is-a-rest-api-the-key-to-flexible-system-integration\/"},"modified":"2024-03-12T17:44:51","modified_gmt":"2024-03-12T16:44:51","slug":"what-is-a-rest-api","status":"publish","type":"post","link":"https:\/\/www.teamnext.de\/en\/blog\/what-is-a-rest-api\/","title":{"rendered":"What is a REST API? The key to flexible system integration"},"content":{"rendered":"
\n

<\/span><\/span><\/div>
\n
\n
\"Header<\/div>\n<\/div>\n<\/div><\/section><\/p><\/div>\n\n<\/div><\/div><\/main><\/div><\/div>
\n

What is a REST API? The key to flexible system integration<\/h1>\n

<\/span><\/span><\/div><\/p><\/div><\/div>\n\n<\/div><\/div><\/div><\/div><\/div>
\n

Reading time:<\/span> 9<\/span> minutes<\/span><\/span>\n<\/div><\/section>
\n

Table of contents<\/strong><\/p>\n<\/div><\/section>
\n

<\/div><\/span><\/section><\/div>
\n
<\/span><\/span><\/div><\/p><\/div>

Let’s start with the definitional question and look at the back end of the term:
\nThe abbreviation API<\/strong> stands for application programming interface<\/em>. Such an interface is used to connect other programs to a software system. In this process, data is exchanged at source code level.<\/p>\n

REST<\/strong> stands for representational state transfer<\/em>. We will explain later what this means exactly. For now, it is sufficient to remember that a REST API acts as an interface between distributed systems.<\/p>\n

Digital Asset Management<\/em> (DAM<\/strong> for short) is the technical term for managing digital media<\/a> such as photos and videos. In this article, we will also look at the possibilities offered by a REST API when integrating DAM systems.<\/p>\n<\/div><\/section>
\n

For what purposes is a REST API used?
\n<\/strong><\/h2>\n<\/div><\/section>
\n

REST APIs employ the familiar HTTP protocol and are used for web services that require the automated exchange of information between network applications.<\/p>\n

For instance, an online service such as a web store can be connected to a company’s ERP or PIM<\/a> system via a REST API. Another example would be the integration of a SharePoint<\/a> instance to enable remote working on specific files.<\/p>\n

These individual systems and applications can be set up differently and each have their own data formats and structures. The task of the REST API is then to establish a standardized form of communication between these systems.<\/p>\n<\/div><\/section>
\n

6 principles of a REST API
\n<\/strong><\/h2>\n<\/div><\/section>
\n

The REST standard is based on the six principles listed below. They go back to the computer scientist Roy Fielding, who first described them entirely in 2000. An API in which all mandatory principles have been implemented is also referred to as RESTful<\/strong>. Principle 6 (code on demand) is optional.<\/p>\n

1. Client-server architecture<\/h3>\n

The assumed separation of client (service user) and server is intended for distributing tasks. In practical terms, this means that services provided by a server (e.g. a database server) are requested via the user interface of a software. This makes it easier to scale the system, as both components can be developed independently of each other.<\/p>\n

2. Statelessness<\/h3>\n

Requests from a client must contain all the information that the server needs to be able to process them. The server must not save any session data about the client. This also ensures scalability, as incoming requests can be distributed to any other machine.<\/p>\n

3. Cacheability<\/h3>\n

Frequently occurring responses from a server should be cacheable, so as not to overload the server unnecessarily. For the data in the cache, however, it must be defined how long it is to be retained. This is necessary so that the client does not receive any outdated information.<\/p>\n

4. Uniform interface<\/h3>\n

The interaction between client and server takes place according to uniform standards based on four conditions:<\/p>\n

    \n
  1. Addressability of resources: A server resource can contain a wide variety of data, but it must be uniquely addressable via an URL.<\/li>\n
  2. Resource manipulation through representations: Clients can interact with resources via data interchage formats such as JSON<\/a> or XML<\/a>. Such formats contain all the information required to modify or delete a resource.<\/li>\n
  3. Self-descriptive messages: Messages must already contain the information required for interpretation by a client or server.<\/li>\n
  4. HATEOAS<\/a> (Hypermedia as the Engine of Application State<\/em>): This means that clients can navigate dynamically through application resources using links embedded in the server responses.<\/li>\n<\/ol>\n

    5. Layered systems<\/h3>\n

    Requests must be routable through independent network layers such as proxy servers<\/a> or load balancers<\/a>. The client or server code should not be changed. Such intermediate layers can greatly improve the performance and security of a system.<\/p>\n

    6. Code on demand (optional)<\/h3>\n

    This principle states that the server may transfer code to the client for local execution if required.<\/p>\n<\/div><\/section>
    \n

    The meaning of REST<\/h3>\n<\/div><\/section>
    \n

    Now we are also ready to give meaning to the term representational state transfer<\/em>. It describes the transition from the current to the next state of an application. This state transition takes place through the transfer of representation data, which is accessed using standardized HTTP methods. These methods are also called HTTP verbs. We will therefore explain the five most important of these in the next section.<\/p>\n<\/div><\/section>
    \n

    The 5 most important HTTP methods<\/h2>\n<\/div><\/section>
    \n
      \n
    1. GET<\/strong> – Requests a specified resource from the server. The state on the server is not changed. GET is the most common HTTP method, as it is also required for retrieving web pages on the Internet.<\/li>\n
    2. POST<\/strong> – Inserts a new resource below the one specified. The new resource link is returned as a result. POST is used, for example, for form entries or uploading files.<\/li>\n
    3. PUT<\/strong> – The specified resource is created. If the resource already exists, it is changed. The PUT command is therefore important if content needs to be updated.<\/li>\n
    4. DELETE<\/strong> – Deletes the specified resource.<\/li>\n
    5. HEAD<\/strong> – Requests metadata for the specified resource.<\/li>\n<\/ol>\n<\/div><\/section>
      \n

      Functional sketch of a REST API<\/h2>\n<\/div><\/section>
      \n
      \"\"

      Figure: REST API<\/a>, Author: Seobility – License: CC BY-SA 4.0<\/p><\/div>\n<\/div><\/section>
      \n

      Practical example: Accessing the DAM via REST API
      \n<\/strong><\/h2>\n<\/div><\/section>
      \n

      Digital asset management<\/a> (DAM) platforms enable companies to efficiently store, organize and distribute their digital content such as images, videos or documents. To integrate these contents (resources) into other applications, it can be useful to employ a REST API.<\/p>\n<\/div><\/section>
      \n

      Retrieving and integrating an image into a website<\/h3>\n<\/div><\/section>
      \n

      Let us assume the following:<\/p>\n