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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones Build AI Agents That Are Ready for Production
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
Build AI Agents That Are Ready for Production

"Platform Engineering & DevOps" Trend Report is now LIVE! Learn how internal platforms help developers ship faster with less friction

Join this live webinar to learn safer rollout techniques for schema changes, index testing, and database migrations.

Related

  • 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
  • IT Asset, Vulnerability, and Patch Management Best Practices
  • Zero-Touch Patch Management With PowerShell and Intune: How We Automated Compliance at Scale

Trending

  • Conversational Risk Accumulation: Stateful Guardrails Beyond Single-Turn LLM Checks
  • Introducing RAI Audit Kit: Evidence-Grade Responsible AI Audits in Python
  • The Agentic Agile Office: Streamlining Enterprise Agile With Autonomous AI Agents
  • Logging What AI Agents Do in Salesforce: A Simple One-Object Audit Framework
  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
Likes (7)
Comment
Save
Tweet
Share
43.3K Views

Join the DZone community and get the full member experience.

Join For Free

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

  • 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
  • IT Asset, Vulnerability, and Patch Management Best Practices
  • Zero-Touch Patch Management With PowerShell and Intune: How We Automated Compliance at Scale

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

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:

  • RSS
  • X
  • Facebook