beginnerREST Fundamentals

What is the difference between POST and PUT in a REST API?

POST is used to create a new resource, and the server typically decides the new resource's identifier — calling it repeatedly with the same body creates multiple resources (not idempotent). PUT is used to replace an entire existing resource at a known URI, and calling it repeatedly with the same body produces the same end state (idempotent) — if the resource doesn't exist yet, some APIs treat PUT as an upsert.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What is the difference between POST and PUT in a REST API?

Next Step

Continue to Spring MVC vs WebFlux vs Java Virtual Threads — when would you choose each?← Back to all Spring Boot & Microservices questions