Web Service API Design and How it Works

Over the years working as developers we have come across several RESTful API Design Tips but which missed the most fundamental aspect of the architecture. Many of the APIs tend to fall short of the laws laid out by Dr Fielding the first person to discuss RESTful APIs. Dr Fielding discussed Restful APIs back in 2000 in this doctoral thesis. There are six constraints mentioned in his paper three of which are already known while three others aren’t or at least haven’t received much attention. Below we’ll discuss three of the most important constraints.

Interface Uniformity

Perhaps the best way for anyone to decouple the client from the server is to use what’s called a uniform interface which will enable each part to evolve independently without the need for its models, services, and actions coupled along its API layer. Having a uniform interface allows for the client to easily communicate with the service so as long as it is in the same language but independent of the architecture on the backend. The interface provides a standard means of communicating between the clients and server via the HTTP and URI resources.

A Multi-Layered System

Most people reading this may already know that a web service API often uses a layered system. Every layer has its responsibility and function. You can think of the Model View Controller where you have every layer which has a particular function, and the model will dictate how each data type should be formed. The controller will focus mainly on the incoming actions, and the view focuses on the output. Each layer works independently but will communicate with the other layer. This same principle applies to designing RESTful APIs with every layer closely held together which creates a hierarchy which is modular and ultimately scalable.

The other advantage of using a layered system is that it will allow for API developers to cover various legacy systems which means less frequently used functions can be put into a separate library. The advantage of this is that it shields new and common aspects of the design from it. The other benefit of a layered architecture is that it makes moving system out and into the architecture easy as the technology steadily evolves. This guarantees flexibility and longevity.

Using a layered system also ensures excellent security since it stops attacks right at the proxy layer to prevent attackers from reaching the server. It will also help to keep critical aspects of the system’s architecture behind a firewall. So, the client can’t directly interact with the server which is a great security measure.

COD (Code on Demand)

It is a constraint that most don’t know about and that’s because it is optional. COD allows for the code or the applets to efficiently transmit via the API of the application. So, smart applications can be created which are entirely independent of the confines of a ridged coded structure. However, because this particular constraint was seen as being futuristic back, then it wasn’t taken too seriously. Though now with AI being a growing aspect of computers and mobile computing it is one that is seriously considered.


The three constraints and three others which are virtually unknown make up the RESTful protocol. A look at these constraints is enough to see how one will build upon the other to create flexible, complex and powerful interfaces. These constraints also influence design. So, it is a big part of building APIs both for the web and for artificial intelligence systems used today.

Leave a comment
Click to Hide Advanced Floating Content