Skip to content

Instantly share code, notes, and snippets.

@kyberorg
Last active November 12, 2022 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kyberorg/775d69b309700bfc928d7c97ecfca026 to your computer and use it in GitHub Desktop.
Save kyberorg/775d69b309700bfc928d7c97ecfca026 to your computer and use it in GitHub Desktop.
API Endpoint Design Reference
GET /resources - returns a list of resource items
POST /resources - creates one or many resource items
PUT /resources - updates one or many resource items
PATCH /resources - partially updates one or many resource items
DELETE /resources - deletes all resource items
And for single resource items:
GET /resources/:id - returns a specific resource item based on :id parameter
POST /resources/:id - creates one resource item with specified id (requires validation)
PUT /resources/:id - updates a specific resource item
PATCH /resources/:id - partially updates a specific resource item
DELETE /resources/:id - deletes a specific resource item
POST: creation of a new thing, where the location (ID) of the new thing will be determined by the server. The response is expected to contain a Location header telling the client where the object ended up (POST-redirect-GET pattern).
PUT: creation of a new thing at a client-defined location (in cases where that's allowable), or replacement of the thing at a given location (this includes "updates" where the body being sent by the client is a complete representation of the object, just as you would get from a GET).
PATCH: in-place partial-update of the thing at a given location.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment