REST:API Architecture

REST:API Architecture

REST: API stands for Representational state transfer API

Rules on how an API should be

Rule 1 - Uses Standard HTTP Method

HTTP Methods are as follows:-

  • GET

  • POST

  • PUT

  • PATCH

  • DELETE

The above are standard verbs used to interact with restful API

Rule 2 - JSON Output

It should have a proper data format. The data format can be JSON or XML. There should format for calling API and giving back a response.

Rule 3 - Client - Server

Here client and server are totally separated. They both are not on the same system or in the same file. They must be able to send messages to each other over a network to make requests and get back responses. They both are allowed to scale independently from each other. They can also built separately by different developers.

Rule 4 - Stateless

The meaning of stateless means each request from client to server should contain all the information that is needed to understand and process the request. Without knowing anything previously, each request and response has to be complete which shows the scalability of API and simplifies server-side implementation.

Rule 5 - Resource-based

An API that is centered around resources. It uses a unique resource identifier called a resource locator which is a URL.

NOTE - What makes API Restful

To make API Restful, it uses standard HTTP Methods

Conclusion

The 5 rules which you have seen above are basically an internet which you use daily. You search for something to get a thing in a specific format as a response.