REST conventions & status codes

Resources and verbs

A REST API is a discipline for shaping endpoints: you expose resources (walkers, bookings) at noun paths, and act on them with HTTP verbs. The verb says what; the path names the thing.

  • GET /walkers β€” read the list
  • GET /walkers/42 β€” read one walker
  • POST /walkers β€” create a walker
  • PUT /walkers/42 β€” replace walker 42 wholesale
  • PATCH /walkers/42 β€” update part of walker 42
  • DELETE /walkers/42 β€” remove it

Red flag in an interview: POST /getWalkers or GET /deleteBooking?id=42. Putting the verb in the path, or using GET to change data, tells a senior you haven't internalized REST. The method is the verb.