From the course: Complete Guide to Serverless Web App Development on AWS

Unlock this course with a free trial

Join today to access over 24,600 courses taught by industry experts.

When to use RESTful vs. GraphQL APIs

When to use RESTful vs. GraphQL APIs

- [Instructor] Let's start this new chapter by analyzing the main difference between RESTful and GraphQL APIs and decide when to use each. Let's start by understanding what are RESTful and GraphQL APIs. REST or Representational State transfer is an architectural style for building APIs. It relies on a set of principles like Statelessness, uniform interfaces, and resource-based design. Each resource like users or product is accessed using unique URLs and standard HTTP methods, such as GET, POST, PUT, DELETE. For example, to retrieve a user, you might send a GET request to users and the parameter ID. REST is simple, widely adopted, and works great for many use cases, especially when APIs are stable and not too complex. Now let's talk about GraphQL. GraphQL is a query language for APIs developed by Facebook. Instead of working with predefined endpoints, GraphQL provides a single endpoint where clients specify exactly what data they need in a query. For example, with one request, you can…

Contents