Skip to content

Instantly share code, notes, and snippets.

@yrake
Created February 9, 2019 05:12
Show Gist options
  • Select an option

  • Save yrake/cda638940b98a1080618fe0b77d7cbf0 to your computer and use it in GitHub Desktop.

Select an option

Save yrake/cda638940b98a1080618fe0b77d7cbf0 to your computer and use it in GitHub Desktop.

HTTP Methods - Reference

HTTP METHOD CRUD ENTIRE COLLECTION SPECIFIC ITEM
POST Create 201 (Created), ‘Location’ header with link to /users/{id} containing new ID. Avoid using POST on single resource
GET Read 200 (OK), list of users. Use pagination, sorting and filtering to navigate big lists. 200 (OK), single user. 404 (Not Found), if ID not found or invalid.
PUT Update/Replace 404 (Not Found), unless you want to update every resource in the entire collection of resource. 200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid.
PATCH Partial Update/Modify 404 (Not Found), unless you want to modify the collection itself. 200 (OK) or 204 (No Content). Use 404 (Not Found), if ID not found or invalid.
DELETE Delete 404 (Not Found), unless you want to delete the whole collection — use with caution. 200 (OK). 404 (Not Found), if ID not found or invalid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment