CRUD API Basics

By Chris Lipinski · · 1 min read

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