1. List a collection
GET on a collection returns the list of resources; it is a safe, read-only verb.
GET /users # listTyporithm · medium
Step 1 of 8 · intro card
API Patterns
REST models resources as nouns acted on by HTTP verbs — GET to read, POST to create, PATCH to update, DELETE to remove — returning proper status codes (200/201/404/422). Collections support pagination and filtering, APIs are versioned (/v1), and safe methods stay idempotent.
REST treats your domain as resources named by nouns — /users, /users/:id — and uses HTTP verbs to act on them: GET reads, POST creates, PATCH updates, DELETE removes. The URL identifies the thing; the verb says what to do.
Return meaningful status codes: 200 for a successful read, 201 for a create, 404 when a resource does not exist, and 422 for input that fails validation. The status is part of the API contract.
Collection endpoints should support pagination and filtering via query params, and APIs are versioned (e.g. /v1) so changes do not break clients. Safe and idempotent methods (GET, DELETE) can be retried without side effects.
Resources are nouns; HTTP verbs are the actions.
Use proper status codes: 200/201/404/422.
Version the API and paginate collections.
GET /users # list
POST /users # create
GET /users/:id # read
PATCH /users/:id # update
DELETE /users/:id # deleteConnect each part of the code to the concept before you type.
GET on a collection returns the list of resources; it is a safe, read-only verb.
GET /users # listPOST to a collection creates a new resource, conventionally returning 201 Created.
POST /users # createGET on a single resource path reads that one item, or returns 404 if it is missing.
GET /users/:id # readPATCH applies a partial update to an existing resource identified by its id.
PATCH /users/:id # updateDELETE removes the addressed resource; repeating it is idempotent.
DELETE /users/:id # deleteRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.