Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
About REST API | Introduction to the Course
Professional Web API with Flask
course content

Conteúdo do Curso

Professional Web API with Flask

Professional Web API with Flask

1. Introduction to the Course
2. Database and Models
3. Flask-Smorest and Schemas
4. Endpoints with Blueprints and MethodView
5. Authentication with JWT
6. Deployment

book
About REST API

In the previous chapter, we discussed Web APIs and their role in linking various applications across the internet. Moving forward, we'll explore a distinct category of Web API known as REST API. REST, short for Representational State Transfer, functions as a protocol that APIs utilize for communication. Picture yourself at MacDrive, selecting a menu item. You make a specific request and receive exactly what you ordered. Similarly, REST APIs facilitate a standardized and effective way for different computer systems to communicate over the internet.

REST APIs adhere to several key principles:

  1. Uniform Interface: this principle standardizes the interaction between client and server, enhancing compatibility across different systems;
  2. Client-Server Architecture: in this model, the client (such as your web browser) and the server (where data is stored) function independently. Clients are only required to know resource URIs;
  3. Statelessness: every request from a client must contain all the information necessary for the server to fulfill that request. The server does not retain memory of past requests, treating each one as new;
  4. Cacheability: similar to how you might store snacks in your backpack for later, responses can be cached for faster retrieval;
  5. Layered System: REST supports a tiered system architecture, allowing APIs to be hosted on one server, data to be stored on another, and requests to be authenticated on yet another. Typically, a client cannot distinguish if it is connected directly to the end server or an intermediary;
  6. Code on Demand: this optional feature allows servers to send executable code to clients as part of the response, like JavaScript, enabling clients to temporarily enhance their functionality. This is akin to a web page that provides not only data (HTML, CSS) but also interactive features (JavaScript).

The uniform interface of REST is defined by specific HTTP request types, each serving a unique function:

  • GET: utilized for retrieving information. For example, when you access a webpage, your browser issues a GET request to fetch the content. Similarly, you can request a single item or multiple items from a list, like ordering a burger, cola, or chips separately;
  • POST: used to create a new resource, like posting a new blog entry on a server;
  • PUT: updates existing resources;
  • DELETE: removes resources.

These HTTP requests encompass CRUD (Create, Read, Update, Delete) functionalities, enabling developers to build efficient, robust applications that communicate effectively within the vast digital landscape.

1. In RESTful API design, what does REST stand for?
2. Which protocol is primarily used for communication between clients and servers in web APIs?
3. Which HTTP method is typically used to retrieve data from a web server via an API?
In RESTful API design, what does REST stand for?

In RESTful API design, what does REST stand for?

Selecione a resposta correta

Which protocol is primarily used for communication between clients and servers in web APIs?

Which protocol is primarily used for communication between clients and servers in web APIs?

Selecione a resposta correta

Which HTTP method is typically used to retrieve data from a web server via an API?

Which HTTP method is typically used to retrieve data from a web server via an API?

Selecione a resposta correta

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 3
We're sorry to hear that something went wrong. What happened?
some-alt