DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Building a Scope-Constrained AI Agent for Automated CI Failure Repair
  • AI Is Finding Bugs Faster Than Enterprises Can Patch — Here's What Data Security Teams Should Do
  • Offline-First Patch Management for 10,000 Edge Nodes: A Practical Architecture That Scales
  • Applying Oracle 19c Release Update (RU): A Practical Guide from My DBA Experience

Trending

  • Rebuilding Elasticsearch Under Load: Unsafe Watermarks and a Sampling Blind Spot
  • Genkit Go vs ADK Go 2.0: A Hands-On Look at Boilerplate and Low-Level Control
  • Going All In On the JVM 25 Virtual Threads
  • Engineering AI Accountability: Control the Execution Path, Not the Model

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

  1. DZone
  2. Software Design and Architecture
  3. Security
  4. The Simple Guide to HTTP Verbs: PATCH, PUT, and POST

The Simple Guide to HTTP Verbs: PATCH, PUT, and POST

The next time you design a RESTful API or web app, you'll likely incorporate HTTP verbs. It's important to understand the subtle differences between PATCH, PUT, and POST.

By 
Ross Garrett user avatar
Ross Garrett
·
Feb. 08, 17 · Opinion
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
43.5K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

The terms PATCH, PUT, and POST are often confused with each other. Many resources promote the concept of CRUD (create, read, update, delete) applications and tie HTTP verbs into a single part of the process. The reality is far more complex than a short acronym, especially as you run into overlapping functionality and other complications.

The differences between them are subtle but can make significant changes in the way you create and update resources. It's time to shed some light on PATCH, PUT, and POST, and when you should use each. 

POST

You use POST to create a resource and instruct the server to make a Uniform Resource Identifier (URI) for it. For example, when you want to create a new article you would POST to /articles to make the file and get the URI, so you end up with /articles/1234/. 

PUT

PUT also creates resources, but it does so for a known URI. So, you can PUT to /articles/1234/. If the article doesn't exist, PUT creates it. If it does exist, this HTTP verb updates it. While PUT seems nearly identical to POST, the difference between the two comes down to idempotence. 

Idempotence is a property that creates identical side effects whether you have one or many results. PUT has this characteristic, while POST creates new resources infinitely. In general, POST works best for resource creation, while PUT handles updates.  

PATCH

So, where does PATCH come into the picture? This HTTP verb partially updates resources without sending the complete representation of it. When you're working with complicated objects and resources, it's a big deal to update more than you need to.  

With this example...

{ "first_name": "Claude", "last_name": "Elements", "email": "[email protected]", "favorite_color": "blue" }

...PATCH allows you to change the color with JSON :{ "favorite_color": "purple" }.

The next time you design a RESTful API or build a new web application, you will probably incorporate HTTP verbs. Understanding the subtle differences between PUT, POST, and PATCH can have a significant effect on the way you use these verbs. Overall, you improve your experience when integrating and building cooperative apps. 

POST (HTTP) Patch (computing)

Opinions expressed by DZone contributors are their own.

Related

  • Building a Scope-Constrained AI Agent for Automated CI Failure Repair
  • AI Is Finding Bugs Faster Than Enterprises Can Patch — Here's What Data Security Teams Should Do
  • Offline-First Patch Management for 10,000 Edge Nodes: A Practical Architecture That Scales
  • Applying Oracle 19c Release Update (RU): A Practical Guide from My DBA Experience

Partner Resources

×

Comments

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด
  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด
  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด
  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด
  • ⭐ Must Read: articles/the simple guide to http verbs patch put and post - สรุปดราม่าล่าสุด