We've Rested Long Enough, What's Next?

Rate this content
Bookmark

Many developers are familiar with consuming/designing RESTful APIs, but what about building and consuming GraphQL and gRPC APIs? What about event-driven or asynchronous APIs? What are the benefits and technical limitations of each? Let’s go down the rabbit hole and explore some of these API types as alternatives to REST.

This talk has been presented at TestJS Summit 2023, check out the latest edition of this Tech Conference.

FAQ

Ian Douglas is a senior developer advocate at Postman with extensive experience in the tech industry, having worked at over a dozen start-ups. He has also spent over eight years in the advocacy space, including four years in education.

Ian Douglas covered RESTful APIs, event-driven APIs like webhooks and WebSockets, and low latency performance APIs like gRPC in his talk at TestJS.

A RESTful API is an API that adheres to REST (Representational State Transfer) standards, allowing for stateless communication between client and server. It has been widely taught and used in software development.

RESTful APIs have limitations such as underfetching or overfetching data, difficulty in handling asynchronous communication, and lack of support for long-lived connections.

GraphQL allows clients to specify which fields to return in a request, reducing issues with underfetching or overfetching data. It also supports a publish-subscribe pattern for streaming data called subscriptions.

WebSockets and WebHooks are types of event-driven APIs. WebSockets allow for long-lived connections where either side can send data at any time, while WebHooks are typically used for response mechanisms, such as triggering an action when an event occurs.

gRPC is an API architecture developed by Google that is built on top of HTTP/2. It allows for long-lived connections, streaming data in either direction, and uses a binary data format. It is typically more performant than RESTful APIs and supports multiple data transfer mechanisms.

HTTP/3 is based on the QUIC protocol, which uses UDP instead of TCP, reducing communication chatter. It supports session management, familiar HTTP methods, headers, and status codes, and has been widely supported in major browsers since 2020-2021.

Choosing an API architecture can impact team performance based on the team's familiarity with the technology. Learning new technologies may slow down development, while using familiar technologies can speed up the process. Infrastructure support and ease of migration also play crucial roles.

You can contact Ian Douglas on most social platforms, including LinkedIn and Twitter, using the username iandouglas736. He also provided a QR code during his talk for accessing his contact information.

W. Ian Douglas
W. Ian Douglas
17 min
11 Dec, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This Talk compares RESTful APIs, event-driven architectures, and low latency performance APIs. It discusses the limitations of RESTful APIs and the need for newer technologies like GraphQL. The Talk explores event-driven architecture using webhooks and web sockets, as well as the benefits of gRPC as a performant alternative. It also highlights the integration of gRPC with front-end development and the use of protocol buffers for improved performance. Lastly, it emphasizes the importance of considering team familiarity and infrastructure when choosing an API architecture.

1. Introduction

Short description:

Hi, everyone. I'm Ian Douglas, a senior developer advocate at Postman. Today, I'll be comparing RESTful APIs, event-driven architectures, and low latency performance APIs. Let's dive in!

Hi, everyone. I'm Ian Douglas. I'm a senior developer advocate at Postman, and thanks for having me at TestJS. I'm going to do a talk today comparing RESTful APIs, event-driven I've been in the tech industry a really long time. Most of my gray hair comes from working at over a dozen start-ups and having two teenagers. I've spent over eight years in the advocacy space, four years of which were in education, teaching people about software. On the side, I'm also really into dog training, 3D printing, career coaching, and I really like really awful jokes, so you'll see some of those on my slides as well.

2. RESTful Standards and Event-Driven APIs

Short description:

In this part, we'll discuss RESTful standards, event-driven APIs like web hooks and web sockets, and low latency performance APIs like gRPC. RESTful APIs have become popular, but they need to keep up with newer technology. HTTP 1 has limitations, such as the lack of interrupting a client and underfetching or overfetching data. Technologies like GraphQL provide more efficient ways of sending data. We'll also explore event-driven architecture, including WebSockets and WebHooks, which allow for asynchronous, event-driven processing.

So this is the quick agenda that we're going to go over. I'm going to give you some background on RESTful standards. We're going to talk about event-driven APIs like web hooks and web sockets, and then we're going to talk about low latency performance APIs like gRPC.

So REST was defined in 2000. A lot of people that are working in software development nowadays know what REST services are. The term RESTful services came shortly after within a few years, although there's no very easy way to determine when the term itself came to be. It happened because most developers didn't like following such strict rules. They wanted some flexibility in what they built. Most schools nowadays that are teaching API design are teaching RESTful API design, or they're teaching API consumption with RESTful APIs primarily. Postman actually has a student program where we work with schools to get students using Postman about other kinds of API architectures, as well. As popular as it's been, RESTful APIs seem a little bit stuck on HTTP version 1.1 territory and kind of needs to keep up with newer technology. Companies like Google started introducing new protocols like speedy, which was the basic basis for HTTP 2.0.

For example, in HTTP 1, it's a little bit like a phone call where I call someone and I ask them a single question, I get a single answer and then we hang up the phone. The next time I need to call somebody and get more information, I have to call, identify myself, ask them my question, get my response, and hang up. The other problem with HTTP 1 is there's no way to interrupt a client. If a client connects to a server and says, I'd like to upload some data, the server can say okay, and the server can just blast gigabytes or terabytes of data before the server is allowed to interrupt and say, wait, I can't process all the data that you just sent. We also have a problem in RESTful technologies that we call underfetching or overfetching, which is where we don't have efficient ways of sending data. We're either sending too much data and expecting our front ends to hide that data, which can lead to security issues, or we don't send enough data, which means I've got to make more and more of these connections again. So technologies like GraphQL came on the scene, allowing the client to specify which fields to return as part of the request. This could happen in REST with parameters, but it's a little more difficult to do that and puts a little more work on the developer to be able to implement which fields to send back as part of a query parameter, for example.

If you've been working with front-end development and front-end technologies, you've probably worked with WebSockets or any sort of collaborative feature, like a chat message system or event-driven applications like games. So, I'm going to give you a quick lesson on WebSockets and WebHooks as we look at event-driven architecture for a moment. The idea of asynchronous APIs is that they're event-driven. There's two classic methods, WebHooks and WebSockets, as I mentioned. They're still HTTP-based, and so they make a connection, they transfer data, and then they disconnect. WebSockets, though, unlike RESTful APIs and WebHooks, can keep a connection open for a long period of time, and either side can send data back and forth at any point. And so it allows for event-driven processing, that when something happens, you can transmit that over a connection that's already open. Developers don't necessarily need to pause and wait for a response before continuing work. So I can send a request, and then I can continue my event loop, waiting for other user interaction and wait for that response to come back. So, event loops like promises and other mechanisms called async and await allow developers to choose when to pause execution to wait for a response or to just process it in the background.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

A Guide to React Rendering Behavior
React Advanced Conference 2022React Advanced Conference 2022
25 min
A Guide to React Rendering Behavior
Top Content
This transcription provides a brief guide to React rendering behavior. It explains the process of rendering, comparing new and old elements, and the importance of pure rendering without side effects. It also covers topics such as batching and double rendering, optimizing rendering and using context and Redux in React. Overall, it offers valuable insights for developers looking to understand and optimize React rendering.
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Network Requests with Cypress
TestJS Summit 2021TestJS Summit 2021
33 min
Network Requests with Cypress
Top Content
Cecilia Martinez, a technical account manager at Cypress, discusses network requests in Cypress and demonstrates commands like cydot request and SCI.INTERCEPT. She also explains dynamic matching and aliasing, network stubbing, and the pros and cons of using real server responses versus stubbing. The talk covers logging request responses, testing front-end and backend API, handling list length and DOM traversal, lazy loading, and provides resources for beginners to learn Cypress.
React Concurrency, Explained
React Summit 2023React Summit 2023
23 min
React Concurrency, Explained
Top Content
Watch video: React Concurrency, Explained
React 18's concurrent rendering, specifically the useTransition hook, optimizes app performance by allowing non-urgent updates to be processed without freezing the UI. However, there are drawbacks such as longer processing time for non-urgent updates and increased CPU usage. The useTransition hook works similarly to throttling or bouncing, making it useful for addressing performance issues caused by multiple small components. Libraries like React Query may require the use of alternative APIs to handle urgent and non-urgent updates effectively.
Testing Pyramid Makes Little Sense, What We Can Use Instead
TestJS Summit 2021TestJS Summit 2021
38 min
Testing Pyramid Makes Little Sense, What We Can Use Instead
Top Content
Featured Video
Gleb Bahmutov
Roman Sandler
2 authors
The testing pyramid - the canonical shape of tests that defined what types of tests we need to write to make sure the app works - is ... obsolete. In this presentation, Roman Sandler and Gleb Bahmutov argue what the testing shape works better for today's web applications.
The Future of Performance Tooling
JSNation 2022JSNation 2022
21 min
The Future of Performance Tooling
Top Content
Today's Talk discusses the future of performance tooling, focusing on user-centric, actionable, and contextual approaches. The introduction highlights Adi Osmani's expertise in performance tools and his passion for DevTools features. The Talk explores the integration of user flows into DevTools and Lighthouse, enabling performance measurement and optimization. It also showcases the import/export feature for user flows and the collaboration potential with Lighthouse. The Talk further delves into the use of flows with other tools like web page test and Cypress, offering cross-browser testing capabilities. The actionable aspect emphasizes the importance of metrics like Interaction to Next Paint and Total Blocking Time, as well as the improvements in Lighthouse and performance debugging tools. Lastly, the Talk emphasizes the iterative nature of performance improvement and the user-centric, actionable, and contextual future of performance tooling.

Workshops on related topic

React Performance Debugging Masterclass
React Summit 2023React Summit 2023
170 min
React Performance Debugging Masterclass
Top Content
Featured WorkshopFree
Ivan Akulov
Ivan Akulov
Ivan’s first attempts at performance debugging were chaotic. He would see a slow interaction, try a random optimization, see that it didn't help, and keep trying other optimizations until he found the right one (or gave up).
Back then, Ivan didn’t know how to use performance devtools well. He would do a recording in Chrome DevTools or React Profiler, poke around it, try clicking random things, and then close it in frustration a few minutes later. Now, Ivan knows exactly where and what to look for. And in this workshop, Ivan will teach you that too.
Here’s how this is going to work. We’ll take a slow app → debug it (using tools like Chrome DevTools, React Profiler, and why-did-you-render) → pinpoint the bottleneck → and then repeat, several times more. We won’t talk about the solutions (in 90% of the cases, it’s just the ol’ regular useMemo() or memo()). But we’ll talk about everything that comes before – and learn how to analyze any React performance problem, step by step.
(Note: This workshop is best suited for engineers who are already familiar with how useMemo() and memo() work – but want to get better at using the performance tools around React. Also, we’ll be covering interaction performance, not load speed, so you won’t hear a word about Lighthouse 🤐)
Designing Effective Tests With React Testing Library
React Summit 2023React Summit 2023
151 min
Designing Effective Tests With React Testing Library
Top Content
Featured Workshop
Josh Justice
Josh Justice
React Testing Library is a great framework for React component tests because there are a lot of questions it answers for you, so you don’t need to worry about those questions. But that doesn’t mean testing is easy. There are still a lot of questions you have to figure out for yourself: How many component tests should you write vs end-to-end tests or lower-level unit tests? How can you test a certain line of code that is tricky to test? And what in the world are you supposed to do about that persistent act() warning?
In this three-hour workshop we’ll introduce React Testing Library along with a mental model for how to think about designing your component tests. This mental model will help you see how to test each bit of logic, whether or not to mock dependencies, and will help improve the design of your components. You’ll walk away with the tools, techniques, and principles you need to implement low-cost, high-value component tests.
Table of contents- The different kinds of React application tests, and where component tests fit in- A mental model for thinking about the inputs and outputs of the components you test- Options for selecting DOM elements to verify and interact with them- The value of mocks and why they shouldn’t be avoided- The challenges with asynchrony in RTL tests and how to handle them
Prerequisites- Familiarity with building applications with React- Basic experience writing automated tests with Jest or another unit testing framework- You do not need any experience with React Testing Library- Machine setup: Node LTS, Yarn
Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
How to Start With Cypress
TestJS Summit 2022TestJS Summit 2022
146 min
How to Start With Cypress
Featured WorkshopFree
Filip Hric
Filip Hric
The web has evolved. Finally, testing has also. Cypress is a modern testing tool that answers the testing needs of modern web applications. It has been gaining a lot of traction in the last couple of years, gaining worldwide popularity. If you have been waiting to learn Cypress, wait no more! Filip Hric will guide you through the first steps on how to start using Cypress and set up a project on your own. The good news is, learning Cypress is incredibly easy. You'll write your first test in no time, and then you'll discover how to write a full end-to-end test for a modern web application. You'll learn the core concepts like retry-ability. Discover how to work and interact with your application and learn how to combine API and UI tests. Throughout this whole workshop, we will write code and do practical exercises. You will leave with a hands-on experience that you can translate to your own project.
Next.js 13: Data Fetching Strategies
React Day Berlin 2022React Day Berlin 2022
53 min
Next.js 13: Data Fetching Strategies
Top Content
WorkshopFree
Alice De Mauro
Alice De Mauro
- Introduction- Prerequisites for the workshop- Fetching strategies: fundamentals- Fetching strategies – hands-on: fetch API, cache (static VS dynamic), revalidate, suspense (parallel data fetching)- Test your build and serve it on Vercel- Future: Server components VS Client components- Workshop easter egg (unrelated to the topic, calling out accessibility)- Wrapping up
Detox 101: How to write stable end-to-end tests for your React Native application
React Summit 2022React Summit 2022
117 min
Detox 101: How to write stable end-to-end tests for your React Native application
Top Content
WorkshopFree
Yevheniia Hlovatska
Yevheniia Hlovatska
Compared to unit testing, end-to-end testing aims to interact with your application just like a real user. And as we all know it can be pretty challenging. Especially when we talk about Mobile applications.
Tests rely on many conditions and are considered to be slow and flaky. On the other hand - end-to-end tests can give the greatest confidence that your app is working. And if done right - can become an amazing tool for boosting developer velocity.
Detox is a gray-box end-to-end testing framework for mobile apps. Developed by Wix to solve the problem of slowness and flakiness and used by React Native itself as its E2E testing tool.
Join me on this workshop to learn how to make your mobile end-to-end tests with Detox rock.
Prerequisites- iOS/Android: MacOS Catalina or newer- Android only: Linux- Install before the workshop