Create, Update and Delete: POST, PUT, PATCH and DELETE

A FastAPI resource is finished with four routes that change it, POST that answers 201 with the new item, PUT that replaces a whole item, PATCH that changes only the fields sent with model_dump(exclude_unset=True), and DELETE that answers 204 with no body, each answering 404 when the item isn't there.

By

Updated

Cheat sheet: Create, Update and Delete: POST, PUT, PATCH and DELETE
Category
FastAPI
Level
Journeyman
Tags
204 No Content, CRUD, DELETE (HTTP), fastapi, PATCH, PUT, rest-api