0PricingLogin
Flask Academy · Lesson

Read One and Read Many Endpoints

Return a single item or a collection.

Two Shapes of Read

A REST resource needs two read endpoints: one that returns a single item by id, and one that returns the whole collection. 📚

List Route for Many

The collection lives at a plain path like /users. A GET there should answer with every matching record.

@app.route("/users")
def list_users():
    ...

All lessons in this course

  1. Create Records and Commit Sessions
  2. Read One and Read Many Endpoints
  3. Update Existing Records Safely
  4. Delete and Handle Missing Rows
← Back to Flask Academy