From the course: Build REST APIs with FastAPI
What are REST APIs? - Python Tutorial
From the course: Build REST APIs with FastAPI
What are REST APIs?
Let's talk about REST APIs and what they are. And REST APIs actually have two acronyms. The first one is REST, which stands for Representational State Transfer, and API which stands for Application Programming Interface. That's a lot, right? So basically, this is what is known as RPC or Remote Procedure Call, right? Another acronym to help you. And the idea is you have a client that sends a request to the server, say, add 1 to 2, and then the server sends back a reply saying 3. This is a request response, and this is a remote procedure call. So the client and the server can be different processes or even on different machines. And REST usually works on sequence of things or collections of things, let's say, users. And you can do these operations on these users. These operations have another acronym which is CRUD. Stands for Create; I can create a new user, Retrieve; I can get an existing user, Update; I can update a user, maybe change the address, and Delete; I can delete a user from the system if they unsubscribed. And REST APIs usually go through the HTTP transport layer and they use JSON as encoding. And in HTTP we have verbs, right? We have POST, we have GET. So we do these translations between the CRUD and the HTTP verbs. So create is usually a POST request. When you want to retrieve either a single object or maybe query several objects, we do a GET request. When we want to update, it's a PUT or maybe a PATCH, depending on how you implement them. And DELETE is going for the HTTP verb, delete. So this is the basic of REST APIs. And most of the time when you work with servers like FastAPI, they're going to hide these layers from you, but sometimes they bubble up. All abstractions are leaky.