What is Idempotency in REST APIs and Why Should You Care?

Parthipan Natkunam
Nerd For Tech
Published in
4 min readJan 21, 2021

--

banner image showing a laptop with an open terminal, a coffee cup to the left of the laptop and a notepad to the right.
Illustration from https://illlustrations.co/

Idem-what now?

If you have been working with APIs, chances are that you might have heard some of your peers throw around the word “Idempotence”, leaving you to wonder what they really mean by that word anyway.

In this article we’ll look at a detailed answer; so we could learn what this fancy word “Idempotence” actually means in a REST API context.

After reading this article, the next time when your peer says that you need to make an endpoint idempotent, you will know exactly what they are talking about. So let’s get started:

Mathematics to The Rescue :

The word “Idempotent” has its roots in Mathematics. It just means the following:

An operation is said to be idempotent if it doesn’t change the result even when applied multiple times. The multiple operations will have the same effect leaving us with the same result that we obtained when it was applied initially for the first time.

Let have a look at the below operation:

1*1*1*1*1*1*1*1

Initially, when we multiply 1 with 1 we get 1 as the result. After that, no matter how many times we do the same operation of multiplying with 1, the end result remains the same. Hence…

--

--

Parthipan Natkunam
Nerd For Tech

A seasoned Software Engineer with expertise in building scalable web products. Has a passion for teaching and writing. Follow me for insightful tech content.