gRPC vs REST: Comparing API Styles in Practice

<p>In this article, we&rsquo;ll explore APIs created using both the REST architecture and a fairly new player called gRPC. Our goal is to understand how to use these architectural styles to build APIs.</p> <h1>What is REST?</h1> <p>In 2000, Roy Fielding wrote his dissertation and introduced the world to an architecture for distributed systems called &ldquo;Representational State Transfer,&rdquo; or REST for short. He outlined several constraints for system architecture rooted in the principles that drive the web itself. The goal was to leverage decades of wisdom around building distributed systems that helped to ensure good separation of concerns and scalability.</p> <p>Central to the REST philosophy is the concept of hypermedia and hypertext (like the &ldquo;H&rdquo; in HTTP). A RESTful API allows users to interact with resources identified by URLs and encoded in a variety of hypermedia representations (such as JSON, XML, or HTML). Modifying these resources changes the application state. Typically, clients use HTTP as the protocol of choice for building and interacting with RESTful services.</p> <p>An often neglected but critical concept to REST is the idea of hypermedia as the engine of application state (HATEOAS). Simply put, instead of clients choosing what methods to invoke to change an application&rsquo;s state, it&rsquo;s the hypermedia itself that determines what resources a client can interact with and at what time. This is similar to how users interact with web pages today. Users only need to visit a single URL and links provided on the resulting page inform the user where they can browse.</p> <p><a href="https://betterprogramming.pub/grpc-vs-rest-comparing-api-styles-in-practice-28d2a7c9a349">Click Here</a></p>
Tags: APIs gRPC