Skip to main content

9 docs tagged with "api"

View all tags

API Routing and HTTP Verbs for RESTful Endpoints

Following our first API with FastAPI in Creating Your First Web API with FastAPI, this article explores API Routing and HTTP Verbs for RESTful Endpoints. We'll learn how to structure our API with different routes and how to use the correct HTTP methods for each action.

CORS (Cross-Origin Resource Sharing) in FastAPI APIs

Following our lesson on Dependency Injection in FastAPI, this article explains CORS (Cross-Origin Resource Sharing) in FastAPI APIs. CORS is a security feature that browsers implement to control how web pages in one domain can request resources from another domain.

Creating Your First Web API with FastAPI

Following our introduction to Introduction to RESTful APIs: Principles and Design, this article will guide you through Creating Your First Web API with FastAPI. FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.6+ based on standard Python type hints.

Dependency Injection in FastAPI

Following our lesson on Status Codes and Error Handling in Web APIs, this article explores Dependency Injection in FastAPI. This is one of FastAPI's most powerful features, allowing you to manage dependencies and reuse code in a simple and elegant way.

Introduction to RESTful APIs: Principles and Design

This article introduces Introduction to RESTful APIs: Principles and Design. Before we dive into FastAPI, it's crucial to understand the principles of REST, which is the architectural style that most web APIs follow.

Request and Response Bodies: Pydantic models

Following our lesson on API Routing and HTTP Verbs for RESTful Endpoints, this article focuses on Request and Response Bodies: Pydantic models. Pydantic is a library for data validation and settings management using Python type hints. FastAPI uses Pydantic models to define the structure of request and response bodies, providing automatic validation and serialization.

Status Codes and Error Handling in Web APIs

Following our lesson on Request and Response Bodies: Pydantic models, this article focuses on Status Codes and Error Handling in Web APIs. Returning appropriate HTTP status codes and handling errors gracefully is crucial for building a robust and predictable API.

Working with Async HTTP Requests: `aiohttp`

The most common use case for asyncio is to handle I/O-bound tasks, and the most common I/O task in modern software is making network requests. However, the popular requests library is synchronous. If you use it in an async function, it will block the entire event loop, defeating the purpose of asyncio.