A Quick Introduction to REST [Representational State Transfer]

REST or Representational State Transfer is a type of software architecture which consists of using a set of architectural constraints which are applied across data elements, components, and connectors within a hypermedia system. One of the benefits of using REST is that it overlooks the details of each component implementation and the protocol syntax to mainly focus on the roles of these components, their interpretation, and the constraints of their interaction. This is the definition given by Wikipedia but below is the rest api for dummies explanation.

Representational State Transfer

What Does all that Jargon Mean?

Representational State Transfer
Representational State Transfer

For starters, we can be sure that the majority of people didn’t understand the definition of REST above. It is perhaps overly complex, but then again REST is a complex, technical system. However, let us try to break it down into easy language so that everyone can understand what it means.

At the most fundamental level REST is a set of rules which assign how URLs Web standards and HTTP is used.  So, the idea is that if your program complies with REST principles during the development phase, you will end up with a system that uses the internet’s architecture to its max.

Using REST Methods

All software developers know that to connect computers via a network they all should be using the same language or protocol. Over the decades there are several methods which have been developed. Each one of these address communication in a different way. You have probably already heard of technologies like JMS, SOAP, XML-RPC, etc.

Now technologies like SOAP require a lot of data, and so computers need to have adequate capacity to accommodate all that data which makes it unsuitable for mobile application development. Then you have JMS which great for sending messages between computers via the network and is usually used in Java applications. Then you have XML-RPC both of which will make procedural calls over IP but has the same inherent problems as SOAP. Though using both XML-RPC and SOAP is made easier thanks to the right tools and happen to be the tools of choice for mainly Java developers.

Now in contrast to the methods above you have REST which allows for a minimum amount of data to be processed via a well-defined mechanism. So, it bypasses all the possible difficulties associated with bulky protocols. Plus, it allows for developers to create their own programs that can access data via the APIs the right way and so they can work in an environment with variable network speeds or computers with limited capacity.

Key REST Terms Everyone Should Know

In principle, REST is a lot like a web browser. The resources are shown via a URL. So, in this case, the URL is accessed by a program and data is extracted. So, you need to wrap your head around two principal terms, i.e. ‘representations’ and ‘resources. Resources refer to the thing you want to communicate with, and representation is the entities you want to send.

The resource or resources may be located at an address which a computer will need to send information to or receive it from. So, to do this, it uses HTTP methods Post and Gets. Some resources also store information to create more resources. The other important thing you need to understand is that REST supports many other HTTP methods too like Options, Delete, Trace, Connect, Head and Put. Though the most used are Get and Post.

  • Get: This is usually used to retrieve information which is provided by a resource.
  • Post: will create a resource and will store the information on a server. It will also assign the resource a URL within the database.

The other terms you need to know is “idempotent” which primarily means that the request can be made multiple times. So, the Get command is usually idempotent.

Conclusion

REST is perhaps one of the most overly complicated software architecture subjects that developers need to study. Though once you understand that REST itself is a simple concept which helps to broaden the functionality to satisfy the needs of the customer things become a lot clearer. Developers can benefit a lot from REST especially if they want to make sure that their apps communicate well across the internet.

Leave a Reply

Your email address will not be published. Required fields are marked *