CRUD and REST

Resource actionAssociated HTTP request
CreatePOST
ReadGET
UpdatePATCH
DeleteDELETE

REST is an acronym for Representational State Transfer.

Example: managing users

CRUD is a way of talking about the basic actions we might want to perform with users:

  • create a new user
  • see all the users
  • see a particular user
  • update a particular user
  • delete a particular user
Resource actionPath/routeHTTP requestDescription
Create/usersPOSTCreates a new user with the parcel of data that was POSTed
Read/usersGETGET a list of all users
Read/users/5GETGET the data of user 5
Update/users/5PATCHUpdates the date of user 5 with data that was PATCHed
Delete/users/5DELETEDELETE / delete user 5
/users/newGETGET the form for creating a new user
/users/5/editGETGET the form for editing a new user