Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Postman Tutorial Part 9 – DIfference Between Put and Patch HTTP Methods

Posted on 02/19/2025 By admin

Hello Guys,

Whether you are an API developer or tester, you must understand the difference between PUT and PATCH http methods. It is also a frequently asked interview question. Let’s understand PUT and PATCH in details. 

PUT:-

An HTTP PUT method is used to primarily update the resource information but  it also can be used to create a new resource (Depends on API development) if requested resource is not available.  If PUT request is made to update resource, it should return 200 (OK) and 204 (No Content) status code. If PUT request is made to create a new resource, it must return a status code 201( Created). 

When a PUT request is sent to server, request body is used to replace existing resource at server if available or created new resource if not available. Since PUT is either replacing or creating a resource on server, you may need to pass a full body of request which requires more bandwidth. Also a GET request is hit first to check existence of resource.   

PATCH:-

An HTTP PATCH method is used to update information partially or completely (May be) of already existing resource at server and produces a new version of resource with updated information. It is different from PUT as PUT updates/replace complete information of resource while PATCH updates  some information of resource. It returns  200 (OK) and 204 (No Content) status code. 

A PATCH method is not safe method as it operations on modification of data. It is also non-idempotent but can be made idempotent.

As per RFC-5789:

The difference between the PUT and PATCH requests is reflected in the way the server processes the enclosed entity to modify the resource identified by the Request-URI. In a PUT request, the enclosed entity is considered to be a modified version of the resource stored on the origin server, and the client is requesting that the stored version be replaced. With PATCH, however, the enclosed entity contains a set of instructions describing how a resource currently residing on the origin server should be modified to produce a new version.

An example is as below:

Suppose, server stores a student details (Information representation in JSON as an example) as:

{
  "firstName":"Amod",
  "lastName":"Mahajan",
  "age":29,
  "address":"India"
}

You hit a PUT request to a student id say 123 with full body. First resource with given ID will be searched. If found, old resource information at server will be replaced by new one else, will be created a new resource on server. But if you want to update some data like firstName only, you should use patch and send only required information to be updated. Ideally it should throw a proper error message if request respurce is not found at server.

More about API Testing in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.If you like my posts, please like, comment, share and subscribe.#ThanksForReading

#HappyApiTesting

Uncategorized

Post navigation

Previous Post: Postman Tutorial Part 45 – Data Driven Testing in Postman Using JSON File
Next Post: REST Assured Tutorial 44 – Fetch Value From JSON Object Using JsonNode – Jackson – get() & path() Methods

Related Posts

March 28, 2018 – Make Selenium Easy Uncategorized
Interview Experience at McKinsey Bangalore for Selenium Java Profile ( Sep – 2019) Uncategorized
oauth 2.0 Uncategorized
how to install testng plugin in eclipse Uncategorized
googletext – Make Selenium Easy Uncategorized
TestNG Tutorials 39: Run Only Test From a TestNG Class Without Using TestNG XML? Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark