Skip to content

Idempotence

Mahmoud A. Zaid edited this page Mar 12, 2019 · 1 revision

Idempotence

  • is the property of certain operations in mathematics and computer science that they can be applied multiple times without changing the result beyond the initial application.

Let's talk about the common methods GET, POST, DELETE and PUT

For Example if you sent a GET method to retrive a ressource from the server let's say message/5 and you sent the same request again the server will replay with the same resource nothing will be changed

this for GET but what about DELETE and PUT

DELETE Request to Delete Message/10 and you sent the same request again to the server nothing will be changed because the Message/10 already deleted.

PUT the methode here sent to server for replaceing Message/20 and you sent it again nothing will be changed on the server because you will replcae the Message/20 with the Message/20.

Now let's talk about POST if you sent a POST request to the server message the server will create a new resource message/21 and if you repeat this request again the server will create another resource message/22

so we can calssify GET, DELETE and PUT methods as repeatble methode but POST can not be repeated safely Also you need to know GET, PUT and DELETE are idempotent methods but POST is non-idempotent method

Clone this wiki locally