Course outline · 0% complete

0/29 lessons0%

Course overview →

Designing the Notes API

lesson 9-1 · ~11 min · 27/29

Quiz

Warm-up spanning the course. A request hits POST /login with a wrong password for a real account. Combining lessons 3-3 and 7-4: status code and message?

The spec

Time to design a complete service: a personal notes API. Requirements: users sign up, log in, and manage only their own notes.

Applying unit 4's grid, the whole surface is six endpoints:

EndpointPurposeAuth?Success
POST /signupcreate account (hash the password, lesson 7-1)no201
POST /loginverify password, start a session (lesson 7-2)no200
GET /noteslist my notes, paginated (lesson 4-2)yes200
POST /notescreate a note (validated, lesson 5-3)yes201
PUT /notes/:idupdate my noteyes200
DELETE /notes/:iddelete my noteyes204

Failures reuse the lesson 4-3 shape everywhere: 401 unauthorized when not logged in, 403 for someone else's note, 404 for a missing id, 400 invalid_input from validation, 429 from the limiter on /login.

ratelimiterauthsession checkvalidationreject bad inputhandlerbusiness logicresponsestatus + JSONrepositorydata layerevery request walks the same pipeline you built, stage by stage
The full request path of the notes API. Each stage is a lesson from this course, now standing in one line.

Quiz

A logged-in user requests PUT /notes/17. Note 17 exists but belongs to another user. Walking the pipeline: which stage rejects it, and with what?

Problem

Design check: POST /notes succeeds and the new note is returned to the client. Which status code does the response carry? Answer with the number.