So, you know REST
Is REST all about just exposing an HTTP endpoint?
REST is an abbreviation that stands for Representational State Transfer. A lot of complex words but stick with me.
REST is a specification that suggests how a client should demand/request information from the server and how the server should respond; it does not enforce anything.
Everything is a Resource
In REST, everything is a resource. Any actionable entity in your application eg: book, student, customer, or order is a resource for REST. The client can demand action on a resource like get, create, delete, or update.
REST does not put any restriction on how the data is stored in your application, but it allows clients to specify how it wants the data from the server eg: XML, JSON, CSV, etc. So long as the server supports the representation the server would respond in the demanded format.
Underlying Protocol for REST
REST does not enforce any restriction on the underlying protocol to be used. All it cares about is that we have a defined way to act on a resource. So, we can implement REST over HTTP or even hardware like USB.
Why REST over HTTP?
The most common implementation of REST is over HTTP and it gels very well together. Why so?
HTTP has verbs like GET, POST, DELETE, and PUT and these become actions on our resource. The resource is specified by the URL of the HTTP request. For example, to get a student's details whose id = 1 we fire
GET /students/1
We are representing the student with id = 1 using the URL /students/1 and are specifying action GET using the HTTP verb GET. Similarly to update the student with id = 1 we could
POST /students/1
Here we see how REST is resource-oriented and we have a way to specify the action to be taken on it.
Existing tooling
One very important reason why HTTP is so commonly used in implementation is the availability of existing tooling. We can reuse the existing set of tools to get the job done, which includes.
Downsides of doing REST over HTTP
领英推荐
Here's the video of my explaining this in-depth ?? do check it out
REST is how browsers talk to our servers. 99.99% of all your API requests that originates from your browser and go to your API servers are REST. So, what is REST? How is it different from HTTP? Is it a protocol or what? There are so many unanswered questions like this.
In this video, we in-depth talk about REST, understand the foundations of it, see how and why it gels so well with HTTP, find out why everyone is using it, and conclude by going through the downsides of using REST over HTTP.
Outline:
You can also
Thank you so much for reading ?? If you found this helpful, do spread the word about it on social media; it would mean the world to me.
Yours truly,
Arpit
Until next time, stay awesome :)
I teach a course on System Design where you'll learn how to intuitively design scalable systems. The course will help you
I have compressed my ~10 years of work experience into this course, and aim to accelerate your engineering growth 100x. To date, the course is trusted by 600+ engineers from 10 different countries and here you can find what they say about the course.
Together, we will build some of the most amazing systems and dissect them to understand the intricate details. You can find the week-by-week curriculum and topics, benefits, testimonials, and other information here https://arpitbhayani.me/masterclass .
Top Voice on Web | Senior Software Engineer | Ex- HackerRank, Interview Kickstart | Open Source | Philanthropist
2 年Pretty neat writeup. There's a typo however do fix if required.
More about me: arpitbhayani.me Newsletter: arpitbhayani.me/newsletter Subscribe #AsliEngineering for such in-depth engineering concepts: https://www.youtube.com/c/ArpitBhayani Check out my System Design course: arpitbhayani.me/masterclass