What is the HTTP Patch Method? (computing) Definition | API Glossary (2024)

An Introduction to the HTTP PATCH Method

HyperText Transfer Protocol (HTTP) specifies the way in which clients and servers on the World Wide Web communicate with each other.

This communication is accomplished through the use of HTTP request methods.

For example, the most commonly used method, GET, is used by a client to request that a web server provide a specified resource.

This is the method that your web browser sends when requesting that a web page begin loading a particular page. GET is not the only HTTP method provided by the HTTP protocol, however.

Another, more specialized HTTP method is PATCH.

Patch Example

Consider a resource, employee. The JSON representation of an example might look like this:

{ "name":"John Doe", "department":"sales", "salary":65500}

If the salary field of this employee record needed updating, the PUT method could be used to replace the employee, but this would be wasteful.

{"name":"John Doe", "department":"sales", "salary":70000}

The PATCH command could be used instead to send only the new salary:

{"salary":70000}

In the trivial example presented here, the savings from using PATCH is obviously very small, but for a more complex case, where objects contain much more data, the savings could be very material.

Patch vs PUT

The HTTP PATCH method can be used when a resource needs to be updated. This method is especially useful if a resource is large and the changes being made are small.

The HTTP PUT method can be used to create a new resource or to replace an existing resource with a new resource. However, the entire resource must be replaced.

There are some cautions to keep in mind when choosing to use PATCH over PUT. PUT is guaranteed to be idempotent. PATCH is not. Likewise, PUT is considered “safe” in the sense of RFC 2616, while PATCH is not.

Summary

The PATCH method could return a number of different status codes. For a successful PATCH, common status codes would likely be 200 (OK) or 204 (No Content). If the PATCH method was unsuccessful, status codes such as 304 (Not Modified), 400 (Bad Request), or 422 (Unprocessable Entity) may be seen.

Many applications have potential benefits from the use of the PATCH command and it should certainly be considered when designing the methods a web application will support. Support for PATCH does bring with it more complex than required for support of PUT alone, but the benefits are absolutely worth considering.

What is the HTTP Patch Method? (computing) Definition | API Glossary (2024)
Top Articles
How to Survive a Stock Market Crash
Planning a Trip Budget that Works for You
No Hard Feelings (2023) Tickets & Showtimes
Amc Near My Location
Bashas Elearning
El Paso Pet Craigslist
Mackenzie Rosman Leaked
Voordelige mode in topkwaliteit shoppen
Explore Tarot: Your Ultimate Tarot Cheat Sheet for Beginners
La connexion à Mon Compte
Brgeneral Patient Portal
Craigslist Furniture Bedroom Set
Monticello Culver's Flavor Of The Day
Mndot Road Closures
Progressbook Brunswick
Lonesome Valley Barber
Rugged Gentleman Barber Shop Martinsburg Wv
BMW K1600GT (2017-on) Review | Speed, Specs & Prices
College Basketball Picks: NCAAB Picks Against The Spread | Pickswise
Mybiglots Net Associates
January 8 Jesus Calling
Paris Immobilier - craigslist
Cor Triatriatum: Background, Pathophysiology, Epidemiology
Narragansett Bay Cruising - A Complete Guide: Explore Newport, Providence & More
Orange Park Dog Racing Results
Stephanie Bowe Downey Ca
Osrs Important Letter
Dl.high Stakes Sweeps Download
Ezstub Cross Country
Cavanaugh Photography Coupon Code
Elanco Rebates.com 2022
Σινεμά - Τι Ταινίες Παίζουν οι Κινηματογράφοι Σήμερα - Πρόγραμμα 2024 | iathens.gr
Chattanooga Booking Report
Indiana Immediate Care.webpay.md
Bridger Park Community Garden
Pensacola 311 Citizen Support | City of Pensacola, Florida Official Website
Top-ranked Wisconsin beats Marquette in front of record volleyball crowd at Fiserv Forum. What we learned.
Honda Ruckus Fuse Box Diagram
Natashas Bedroom - Slave Commands
Emerge Ortho Kronos
Craigslist Summersville West Virginia
Compare Plans and Pricing - MEGA
Dee Dee Blanchard Crime Scene Photos
Discover Wisconsin Season 16
2007 Jaguar XK Low Miles for sale - Palm Desert, CA - craigslist
Craigslist Farm And Garden Reading Pa
Inducement Small Bribe
Iman Fashion Clearance
Mit diesen geheimen Codes verständigen sich Crew-Mitglieder
Google Flights Missoula
Great Clips Virginia Center Commons
Generator für Fantasie-Ortsnamen: Finden Sie den perfekten Namen
Latest Posts
Article information

Author: Ouida Strosin DO

Last Updated:

Views: 5766

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Ouida Strosin DO

Birthday: 1995-04-27

Address: Suite 927 930 Kilback Radial, Candidaville, TN 87795

Phone: +8561498978366

Job: Legacy Manufacturing Specialist

Hobby: Singing, Mountain biking, Water sports, Water sports, Taxidermy, Polo, Pet

Introduction: My name is Ouida Strosin DO, I am a precious, combative, spotless, modern, spotless, beautiful, precious person who loves writing and wants to share my knowledge and understanding with you.