Zest.

HTTP methods

HTTP methods describe what a request wants to do with a resource. Two properties matter most when you design an API: whether a method is safe (it only reads) and whether it is idempotent (repeating it has the same effect as doing it once).

HTTP methods
MethodPurposeSafeIdempotentBody
GETRetrieve a resource.✓✓–
HEADLike GET, but only the headers.✓✓–
POSTSubmit data; creates something or triggers processing.––✓
PUTReplace a resource completely, or create it at a known URL.–✓✓
PATCHApply a partial change to a resource.––✓
DELETERemove a resource.–✓–
OPTIONSAsk which methods and headers a URL supports. Used by CORS preflight.✓✓–
CONNECTOpen a tunnel through a proxy, such as for HTTPS.–––
TRACEEcho the request back for diagnostics. Usually disabled for security.✓✓–
MDN reference

How to use it

  1. Use GET to read and never to change data.
  2. Use POST to create or trigger something.
  3. Use PUT to replace, PATCH to change part of a resource, and DELETE to remove it.

This tool is also built into Zest search, so you can type your question into the search box and get the same answer above the results.

Common questions

What does idempotent mean?
An idempotent method gives the same result however many times you repeat it. PUT and DELETE are idempotent, POST is not, so a retried POST can create a duplicate.
PUT or PATCH?
PUT replaces the whole resource with what you send. PATCH applies a partial change. If you only send some fields, use PATCH.