SteelReed

Search

Search posts, questions…

Web & REST APIQuestion 6 / 25

Junior

When do you use GET, POST, PUT, PATCH and DELETE?

Short answer

GET reads, POST creates or triggers processing, PUT replaces the whole resource, PATCH changes part of it, DELETE removes it. Pick the method by its semantics, because caches, proxies, retries and browsers all rely on it.

read, searchcreate, start jobreplace everythingchange some fieldsremovewhat does it do?GET + query paramsPOSTPUTPATCHDELETE

3 points to say:

  1. GET, PUT, DELETE are idempotent; POST is not.
  2. Search uses GET + query params so it can be cached and bookmarked; switch to POST only when filters are too complex or the URL too long.
  3. Anything with a side effect (like starting an export job) is never a GET.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.