REST In Simple Terms

REST In Simple Terms

What is REST ??

REpresentational State Transfer (REST) is an architectural style that defines a set of constraints to be used for creating web services. REST API is a way of accessing web services in a simple and flexible way without having any processing.

What is the difference between APIs and REST APIs?

The main difference between an API and a REST API is the way they communicate with each other.?

An API can communicate using any protocol, data format and architecture that suits your needs. On the other hand, a REST API is based on a set of architectural principles that define how it should be designed and function.

A REST API follows a set of architectural principles that are based on the web and uses the same standards, such as HTTP and URIs.?

Why REST ??

REST technology is generally preferred to the more robust Simple Object Access Protocol (SOAP) technology because REST uses less bandwidth, simple and flexible making it more suitable for internet usage. It’s used to fetch or give some information from a web service. All communication done via REST API uses only HTTP request.

How REST Works

A request is sent from client to server in the form of a web URL as HTTP GET or POST or PUT or DELETE request.
After that, a response comes back from the server in the form of a resource which can be anything like HTML, XML, Image, or JSON.        

Any REST request includes four essential parts: an HTTP method, an endpoint, headers, and a body.

HTTP method describes what is to be done with a resource.There are four basic methods

  1. POST to Create a resource : On successful creation, return HTTP status 201, returning a Location header with a link to the newly-created resource with the 201 HTTP status.)
  2. GET to Retrieve a resource : GET returns a representation in XML or JSON and an HTTP response code of 200 (OK). In an error case, it most often returns a 404 (NOT FOUND) or 400 (BAD REQUEST).
  3. PUT to Update a resource : On successful update, return 200 from a PUT.If using PUT for create, return HTTP status 201 on successful creation.204 if not returning any content in the body from PUT.
  4. DELETE to Delete a resource: It is used to delete a resource identified by a URI. On successful deletion, return HTTP status 200 (OK) along with a response body.

There are other methods which are less frequently used like OPTIONS and HEAD. PATCH: It is used to modify capabilities.The PATCH request only needs to contain the changes to the resource, not the complete resource.

An endpoint contains a Uniform Resource Identifier (URI) indicating where and how to find the resource on the Internet. The most common type of URI is a Unique Resource Location (URL), serving as a complete web address.

Headers store information relevant to both the client and server. Mainly, headers provide authentication data — such as an API key, the name or IP address of the computer where the server is installed, and the information about the response format.

A body is used to convey additional information to the server. For instance, it may be a piece of data you want to add or replace.

What is Code On Demand (CoD) ?

Instead of sending back JSON representations, the server may return a piece of executable code on the client’s demand. The CoD practice gives the client more control over the features and allows for extended functionality.



Benefits of using REST APIs

Here are a few advantages that REST APIs

  • Scalability: Due to the separation between client and server, the product can be scaled by development teams without much difficulty.
  • Flexibility and Portability: Since REST-style APIs require data from one of the requests to be sent properly, it’s possible to perform a migration from one server to another.
  • Independence: With the separation between client and server, the protocol makes it easier for developments across a project to take place independently
  • Lightweight: REST APIs are lightweight and fast, as they utilize the HTTP standard that supports multiple formats including JSON, XML, and HTML.his feature makes it ideal for mobile app projects, IoT devices, and much more.

Disadvantages of a REST API?

  • Increased design complexity : the design of a REST API can be more complex than other APIs, especially if you are not familiar with web architecture.?
  • Web connection : All changes to your REST API must be executed on the web and only on the web. It’s impossible to edit the API from your desktop without an internet connection, unlike HTML web files, for example. You must always connect to make the slightest change.
  • Variable performance and flexibility : REST APIs can have slightly lower performance than other APIs, depending on the servers and their internet speed.



Margaret Rajski, M.A.

INNOVATIVE TECHNOLOGIES: Technical Writing / Regulatory Compliance / Process Mapping and Flows / Gernerative AI

3 个月

Very well done.

要查看或添加评论,请登录

DEBAKANTA JENA的更多文章

  • What is CI/CD ?

    What is CI/CD ?

    Fundamentally , CI & CD is the practice of automating the integration of code changes from multiple developers into a…

  • Load Balancer Vs Reverse Proxy Vs API Gateway

    Load Balancer Vs Reverse Proxy Vs API Gateway

    What is a Load Balancer ? A load balancer act as a traffic distributor ,evenly sending network traffic across several…

    2 条评论
  • Product Pricing:Choosing the Right Approach

    Product Pricing:Choosing the Right Approach

    What is Pricing ?? The amount of money charged for a product or service. Price is the only element in the marketing mix…

  • OAuth 2.0 Explained in Simple Terms

    OAuth 2.0 Explained in Simple Terms

    What is OAuth : OAuth is a open authorization protocol ,which allows users to access different secure applications…

    2 条评论
  • WEB Socket Vs REST Service

    WEB Socket Vs REST Service

    Overview In this article, we’ll go through the basics of client-server communication and explore this through two…

  • Cloud security Farmwork

    Cloud security Farmwork

    User Access Management/ IAM — The Identity and Access Management is to ensure that the right users have the adequate…

  • Multi Path TCP (MTCP)

    Multi Path TCP (MTCP)

    What is Multipath TCP : Multipath TCP is allows single data stream split across multiple path. In multipath TCP it…

社区洞察

其他会员也浏览了