Total Page Preview:   000000000161

Difference between HTTP PUT and HTTP PATCH in Asp.Net Core MVC in English and Hindi

 Differnce between HTTP PUT and HTTP PATCH in English

It's important to choose between HTTP PUT and HTTP PATCH based on your specific use case and requirements. If you need to update the entire resource, HTTP PUT is more appropriate. If you want to make partial updates to a resource, HTTP PATCH is the better choice. Additionally, consider implementing proper validation and security measures to ensure the safe and correct handling of data with both HTTP methods.

HTTP PUT Example:
Let's assume you have a simple API for managing books, and you want to update the details of a book. Here's how you might use HTTP PUT:
In this example, we use HTTP PUT to update an entire book resource based on its ID.
 
HTTP PATCH Example:
Now, let's consider using HTTP PATCH to make a partial update to a book's details:

In this example, we use HTTP PATCH to apply partial updates to a book resource based on its ID. The JsonPatchDocument allows you to specify the changes you want to make in a JSON format.

 

Differnce between HTTP PUT and HTTP PATCH in Hindi

HTTP PUT aur HTTP PATCH dono HTTP (Hypertext Transfer Protocol) mein use hone wale HTTP verb hain, jo ki web servers se communication karne ke liye istemal hote hain, lekin inme antar hota hai:
 
HTTP PUT (Update):
  • PUT request ka main uddeshya server par data resource ko update karna hota hai ya ek naya resource create karna hota hai.
  • Agar PUT request se koi resource update kiya jata hai, to wo resource puri tarah se badal jati hai, yaani ki server ke pass jo data resource hai, uska naya version PUT request ke body se replace ho jata hai.
  • PUT request normally idempotent hota hai, arthath iska multiple bar use se same result milta hai, kyun ki PUT request ke dwara resource ko replace kiya jata hai, chahe wo resource pehle se server par mojud ho ya nahi.
 
HTTP PATCH (Partial Update):
  • PATCH request ka main uddeshya server par data resource ka kewal ek hissa update karna hota hai, jabki baki resource as it is rehti hai.
  • PATCH request se server par bheje gaye data ke hisse ko update kiya jata hai, aur baki data resource mein koi changes nahi hote.
  • PATCH request bhi normally idempotent hota hai, arthath agar aap ek hi PATCH request ko multiple baar bhejte hain, to bhi same result milta hai, kyun ki har bar sirf specified data ke hisse ko update kiya jata hai.
  • To summarize, PUT request se resource puri tarah se badalte hain, jabki PATCH request se resource ka kewal ek hissa update hota hai. Dono hi requests server ke data resource ko modify karne mein istemal kiye jate hain, lekin unke tarike mein antar hota hai.
 
 
 
 

Thank You

About Author

Brijesh Kumar

Database Developer

I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com



Comments


                           
                           

                           

                           

Facebook User: