Skip to catalogue

66

REST

Resources and verbs the HTTP spec already has. GET reads. PUT replaces. POST creates. DELETE removes.

What is REST?

REST models the API as resources with uniform verbs, status codes, and links. It is not “JSON over POST for everything.” GET must be safe. PUT and DELETE should be idempotent.

Why does REST matter when vibe coding?

Models invent `/doThing` POST endpoints and return 200 for failures. Caches, retries, and clients then lie. Name REST and you get nouns, verbs, and status codes.

How do you do REST?

Name the resource. Map the action to a verb. Pick the status: 201 created, 204 no body, 404 missing, 409 conflict, 422 invalid. Do not return 200 with `{ ok: false }`.

How do you ask a model for REST?

REST for (resource). GET is safe. PUT replaces. POST creates. Use real status codes, not 200 with an error field. Do not invent RPC-style /doThing routes.

What goes wrong with REST?

A REST lecture and a single POST /api. If every action is POST, say RPC and own it. Do not cosplay.

adjacent