CRUD API Basics

21st December 2022 · api, web

Create Read Update Delete

Create: HTTP POST - URI best practice: /posts

@app.post('/posts')

Read: HTTP GET - URI best practice: /posts/:id

@app.get('/posts/{id}')

Read (list): HTTP GET - URI best practice: /posts

@app.get('/posts')

Update: HTTP PUT - URI best practice: /posts/:id

@app.put('/posts/{id}')

Delete: HTTP DELETE - URI best practice: /posts/:id

@app.delete('/posts/{id}')

More on FastAPI tutorial