LearnThatStack Ace your next interview
Networking for Developers · question
Question 4 of 51

What are the common HTTP methods, and what does each one do?

beginner
← All Networking for Developers questions
Re-explain

An HTTP method tells the server what action you want on a resource, and each request names one method up front.

  • GET fetches a resource without changing it.
  • POST submits data, often to create something new.
  • PUT replaces a resource with the body you send.
  • PATCH updates part of a resource.
  • DELETE removes the named resource.
  • HEAD fetches only the headers, no body.

The choice matters because caches, proxies and browsers treat methods differently. A GET can be cached and prefetched, but a POST usually cannot. The wrong one causes surprising behavior and confuses anyone reading your API.

Rewriting in plainer words…

This answer doesn't lend itself to a diagram - it reads best . No credits were charged.

Why there's no diagram: “”

The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓

The diagram below the answer is the concept . Jump to it ↓

Tailored explanation · switch back to · ·
What should the new diagram focus on?
Guided practice for Networking for Developers One question at a time. Answer out loud, get graded, see what you missed.
How well did you know this?
AI:

Saved in this browser - sign in to keep your review list.

How should your speech become text?

Listening… your words appear above as you speak - tap Stop when you're done.

Recording · cr - tap Stop & transcribe when you're done.

Transcribing with AI…

Voice:

Keep going - a few more words and AI can grade it.

Interview lens How interviewers actually use this question

Likely follow-ups

  • Which of these methods are safe, and which are idempotent? Separate the two ideas. Safe means no change on the server, idempotent means repeating it leaves the same state. Then say where POST and PATCH fall.
  • When would you use PUT instead of PATCH or POST to update something? Contrast sending the whole resource with sending a partial change, and say what happens to fields you leave out of a PUT body.
  • What goes wrong if a GET endpoint deletes or changes data? Name who else sends GETs without the user meaning to, like browser prefetch and crawlers, and say why caches assume a GET changes nothing.
  • A POST timed out. How would you retry it without creating a duplicate? Mention an idempotency key the server stores, so a repeated request returns the first result instead of acting twice.
  • Why can a cache reuse a GET response but usually not a POST response? Tie it to state. A GET only reads, so a stored copy can answer the next request, while a POST may change something that a replayed answer would skip.

What you can say

  1. An HTTP method is the verb at the start of every request, and it tells the server what you want done to the resource at that URL.
  2. GET reads a resource without changing it, and HEAD is the same request but returns only the headers, with no body.
  3. POST sends data to the server, usually to create something new.
  4. PUT replaces the whole resource with the body you send, PATCH changes only part of it, and DELETE removes it.
  5. The choice matters because browsers, proxies and caches act on the method, so a GET can be cached or prefetched while a POST usually can't.
  6. Pick the wrong one, like a GET that changes data, and a browser prefetch can fire it by accident, and anyone reading your API is misled.

Weak answers to avoid

  • Lists method names with nothing behind them Naming GET, POST and PUT is the easy part. Say what each does to the resource and why caches and browsers treat GET differently from POST.
  • Treats PUT and PATCH as the same thing PUT replaces the whole resource and PATCH changes part of it. Blurring them suggests you would wipe fields on an update, so state the difference plainly.
  • Says GET and POST differ only in where data goes Query string versus body is a detail. The real difference is that GET must not change state, which is why it can be cached and prefetched.
  • Uses GET for actions that change data A crawler or browser prefetch can then delete or change data by accident. Keep GET read-only and use POST, PUT, PATCH or DELETE for changes.
Interview lens

Likely follow-ups, what you can say, and the weak answers to avoid.

Sign in free to open it Free account - the lens opens as soon as you're back.

Want a quick review of the fundamentals? See the Networking for Developers cheatsheet.

← Back to all Networking for Developers questions
Pro · $10/mo

44 of 51 Networking for Developers answers are in Pro.

Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.

  • Full answers + code
  • AI explanations, simpler or deeper
  • 1,000 AI credits / month
  • Cancel anytime