What is a REST API really: the basic idea

REST is an architectural style, developed by Roy Fielding in 2000 for his dissertation. Rest allows software to communicate with other software’s. REST APIs are typically used to develop HTTP services. There are different guidelines for REST, if an API meets them, you can speak of a RESTful web service. In this blog article we discuss what a REST API is and the four different levels of REST.


What is a REST API?

REST stands for Representational State Transfer, and API is the abbreviation of Application Program Interface. First, a brief bit about API. Simply explained, you can think of API as a plug that you want to put in a power strip (system or application). In this way, systems and applications can communicate with each other. An API then provides the input for that communication. This also applies to a REST API, but REST is usually used to develop web services. The big difference between API and REST API is that an API is technically written specifically for a platform or application, while a REST service is built on the principles of HTTP but could theoretically work on other protocols.

Are you struggling with a specific integration issue? Or do you have a question about certain systems, applications or Integration as a Service?

Neem contact op


THE BASIC IDEA OF REST

There are four different levels within REST:

Level 0: The swamp of POX
This level means that you use HTTP, where POX stands for Plain old XML. Technically, REST can be delivered via any application layer protocol, if it meets certain characteristics. In practice, everyone uses HTTP. In level 0, a single HTTP method (POST) is used to create and retrieve resources and often communication takes place based on XML.

Level 1: Resources
Resources are the core data that your application works with. These resources are in a collection. For example, you have resources that belong to another resource called "Customer": a photo, visiting address, delivery address, or contact method. The 'Customer' resource is again part of the 'Customers' collection. Your data is made up of resources and collections, but it is not a relational database. So, the client will build its own links between these resources and collections to retrieve the right information.

Level 2: HTTP Verbs
By using HTTP Verbs you no longer have to specify the action you want to perform as part of the message. The HTTP Verbs indicate the action you can perform on a collection or resource:

  • - GET: Retrieve a resource.

    - POST: Create a resource.

    - PUT/PATCH: Update resource.

    - DELETE: Delete a resource.

  • - OPTIONS: Retrieve possible Methods for resource.


Level 3: Hypermedia Controls

Hypermedia is often seen as a nice-to-have. Building and managing hypermedia takes quite a bit of effort. But if you want to develop a RESTful web service, this is part of it. The purpose of hypermedia is to build links between the resources. For example, the 'Customer' resource also includes a specific address, photo, and employer (see level 1). With hypermedia, you then create a link between the resources that belong together based on HTTP. This way your client does not have to have any knowledge about the relations in your data/API and you gain the ability to change the structure of your data without breaking the clienst application

 

When you go through all these levels, you come to the Glory of REST: only then can you really call an API a REST API. At its core, REST means that you work with collections containing resources, which you have built up in a structured way, so that the structure is clear to every user.

 

WANT TO KNOW MORE ABOUT REST API?

Watch the video below, in which one of our developers explains how to define a good REST API. Need help with REST API? At the moment, our experts are hard at work, but feel free to leave your question or schedule a moment to chat with us.

Contact us for a free consultation

Related articles