What are Idempotent and Non Idempotent methods?
- Get link
- Google+
- Other Apps
Idempotent Methods and Non Idempotent methods
Let's start by understanding the meaning of Idempotent.
Idempotent means "unchanged in value following multiplication by itself"
Idempotent HTTP methods are those methods which will not make any modification event after calling multiple times.
For eg - If your client makes a DELETE request by calling this api - /myapi/id/50
It will delete the record with Id 50. Now think, what happens when the same request gets call multiple times.
Does it make any sense? Does it affect your server anymore?
The answer is NO, why because the record with Id = 50 has been already deleted and does not matter how many times you call the same API.
Same for the PUT operation.
Suppose below API makes a PUT call to update some information
/myapi/id/55
Now this request will update the record as per given form data. Try to make multiple calls with the same API, what will happen. It will affect the same record again and again and will have no further impact on the server side.
So Idempotent methods are those methods which do not make any modification even after multiple executions. GET, PUT and DELETE are common Idempotent HTTP methods.
Non Idempotent Methods
Non-idempotent HTTP methods are those who do effect on the server on every call.
POST method is used to create new resources on the server side. So, POST is non-idempotent methods.
It means every time you make POST call, it writes something at the server end.
Safe Methods
Safe methods are those HTTP methods which does not modify the resources. GET and Head are safe methods.
GET only have view rights i.e. it is read only method. So, no matter how many times you execute a GET method, nothing will change at server end.
GET request can be cached.
A very good example is browser refresh button.
Just browse a page and press refresh button or F5 after few moment it will just do a GET request and serves you the same page.
But, if you have submitted a form on a web page in this case if you hit F5 or press refresh button you will get an alert/warning message because it is not a GET request or not a safe method request.
Hope it will give you a clear idea about Idempotent and Non Idempotent methods.
Happy Coding :)
Prev Blog- How to create secure Web API?
Next Blog - ASP.Net Web API Security
Keep following SharePointCafe.Net
Let's start by understanding the meaning of Idempotent.
Idempotent means "unchanged in value following multiplication by itself"
Idempotent HTTP methods are those methods which will not make any modification event after calling multiple times.
For eg - If your client makes a DELETE request by calling this api - /myapi/id/50
It will delete the record with Id 50. Now think, what happens when the same request gets call multiple times.
Does it make any sense? Does it affect your server anymore?
The answer is NO, why because the record with Id = 50 has been already deleted and does not matter how many times you call the same API.
Same for the PUT operation.
Suppose below API makes a PUT call to update some information
/myapi/id/55
Now this request will update the record as per given form data. Try to make multiple calls with the same API, what will happen. It will affect the same record again and again and will have no further impact on the server side.
So Idempotent methods are those methods which do not make any modification even after multiple executions. GET, PUT and DELETE are common Idempotent HTTP methods.
Non Idempotent Methods
Non-idempotent HTTP methods are those who do effect on the server on every call.
POST method is used to create new resources on the server side. So, POST is non-idempotent methods.
It means every time you make POST call, it writes something at the server end.
Safe Methods
Safe methods are those HTTP methods which does not modify the resources. GET and Head are safe methods.
GET only have view rights i.e. it is read only method. So, no matter how many times you execute a GET method, nothing will change at server end.
GET request can be cached.
A very good example is browser refresh button.
Just browse a page and press refresh button or F5 after few moment it will just do a GET request and serves you the same page.
But, if you have submitted a form on a web page in this case if you hit F5 or press refresh button you will get an alert/warning message because it is not a GET request or not a safe method request.
Method
|
Idempotent
|
Non Idempotent
|
SAFE
|
YES
|
NO
|
YES
|
|
NO
|
YES
|
NO
|
|
PUT
|
YES
|
NO
|
NO
|
DELETE
|
YES
|
NO
|
NO
|
Hope it will give you a clear idea about Idempotent and Non Idempotent methods.
Happy Coding :)
Prev Blog- How to create secure Web API?
Next Blog - ASP.Net Web API Security
Keep following SharePointCafe.Net

Comments
Popular
What is MicroService? A modern approach to develop software applications
Before describing MicroServices we should first understand distributed technologies we already have in the industry. Prior to MicroServices, we have already Web Services, WCF Service and latest one from Microsoft i.e. ASP.Net Web API. Then Why MicroService Architecture?
You may read about all these distributed technologies in details in my earlier blog.
You may read about all these distributed technologies in details in my earlier blog.
CAML Query Tutorial for SharePoint 2013 and 2010 - A Complete tutorial guide
CAML Query is one of the most important topics in SharePoint. CAML Query is the way for querying items from SharePoint objects like List and Library. This blog is helpful in SharePoint 2010 development as well as in SharePoint 2013 development.
How to consume RESTful APi from server side code - C#
What's new in C# 6.0 language - All new features of C# 6.0 for developers
In the previous blog, we have seen
Introduction to .NET Core - Basic Introduction with Visual Studio 2015 and 2017. Other important blogs I wrote - What is MicroServices?Angular JS for ASP.Net Developer.
In this blog, we will learn new features of C# 6.0. C# 6.0 - An another version of C# released in the year 2015. C# 6 provides numerous new features but I will write about those features which I have explored and which are useful for a developer. You must be curious to know What's new in C# 6.0? Let's start.
Introduction to .NET Core - Basic Introduction with Visual Studio 2015 and 2017. Other important blogs I wrote - What is MicroServices?Angular JS for ASP.Net Developer.
In this blog, we will learn new features of C# 6.0. C# 6.0 - An another version of C# released in the year 2015. C# 6 provides numerous new features but I will write about those features which I have explored and which are useful for a developer. You must be curious to know What's new in C# 6.0? Let's start.
Introduction to .NET Core - Basic Introduction with Visual Studio 2015 and 2017
Till now website/application developed using .net framework can be hosted only on windows platform. So, your application is bounded with windows OS. What if someone wants to deploy .net framework based application on Linux or Mac, earlier there was no solution but now it can be achieved using.NET Core. So let's start by introducing.NET Core.
All about SharePoint 2010 Content Type Hub - SharePoint 2010 Tutorial
Top 20 ASP.Net Web API Interview Questions and Answers
In the previous blog, I wrote about What is ASP.Net Web API? You may also like ASP.Net Web API Tutorial
If you are interested in .Net Core then you may go for .Net Core Tutorial.
In this blog, I have collected interview questions and answers of ASP.Net Web API.
If you are interested in .Net Core then you may go for .Net Core Tutorial.
In this blog, I have collected interview questions and answers of ASP.Net Web API.
SharePoint Interview Questions and Answers
If you have landed to this page it means you are searching for SharePoint Interview Questions and answers, right? You are at right place. In this blog, I have collected important SharePoint interview questions and answers.
Candidate having good knowledge of SharePoint will shine like a star in IT industry. So, it is very important to collect more and more SharePoint interview Questions and Answers to qualify SharePoint interview. Below are few SharePoint questions and answers which are very important and most of them were asked in an interview in IT Companies.
Candidate having good knowledge of SharePoint will shine like a star in IT industry. So, it is very important to collect more and more SharePoint interview Questions and Answers to qualify SharePoint interview. Below are few SharePoint questions and answers which are very important and most of them were asked in an interview in IT Companies.
Getting started with Microsoft Azure
If you are new to Microsoft Azure, then please read my earlier blog on Cloud Computing and Microsoft Azure introduction.
In this blog, I will explain how to create resources in Azure Dashboard and will show you screenshots. This will be a totally new experience for me as well because I am also new to Cloud Computing and wanted to share my experience through my blog.
In this blog, I will explain how to create resources in Azure Dashboard and will show you screenshots. This will be a totally new experience for me as well because I am also new to Cloud Computing and wanted to share my experience through my blog.
ASP.Net Web API Security
If you are new to ASP.Net Web API then please start from the beginning level. What is ASP.Net Web API? In the previous blog, I wrote about Routing in Web API. You may also like .Net Core Introduction and MicroService Architecture.
I have also explained, How to create a secure Web API? in my earlier blog.
In this blog, let's discuss the Web API security in details.
I have also explained, How to create a secure Web API? in my earlier blog.
In this blog, let's discuss the Web API security in details.
Very nice blog on HTTP idempotent methods.
ReplyDeleteReally it was good and easy to understand.