REST API and its Component

REST API and its ComponentWeb services cater the need of distributed processing, especially by allowing communication between two electronic devices over a network.

Basically, there are two types of web services:

Rest is not a tool, technology, framework or specification. It is an architectural style describe by Roy Fielding. REST stands for Representational State Transfer, which provides web services based on URLs and HTTP. It is protocol independent and follows the stateless model. REST proves to be very helpful in exposing a public API over the internet to manage create, read, update, and delete operations on the data. REST focuses on using a single consistent interface to access named resources.

REST uses four different HTTP 1.1 verbs (GET, POST, PUT, and DELETE) to perform tasks. You can also make use of different data formats, including Command Separated Value (CSV), JavaScript Object Notation (JSON), and Really Simple Syndication (RSS).

Six Constraints of REST

  1. Stateless – Server contains no client stage. However, the client side holds the session state. Each request contains enough contexts to process the message.
  2. Uniform Interface – Interface between client and server, HTTP verbs (GET, PUT, POST, DELETE), URLs (resource name), and HTTP response (status, body).
  3. Cacheable – Server responses (representations) are cacheable, implicit, explicit, and negotiable.
  4. Layered System – It improves scalability. Usually, the client never informs if it is directly connected to the end server. Intermediary servers may enable load-balancing and provide shared caches to improve system scalability.
  5. Client – Server – Clients from Servers are separated by UI. This separation of concerns means clients are least concerned about the activities at server end, like data storage, etc.
  6. Code on Demand (optional) – Temporarily, servers can transfer the logic to be executed by client. In this way the functionality of a client can be customized.

Difference between REST and SOAP

You may also like: How to Test Representational State Transfer (REST) Style Based Web Services?


Get A Free Quote