Firstly, w3's (confusing) definition of idempotent http methods - https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html.

My understanding of idempotent http methods is that when a request is made using such methods, then the response must always be the same.

How do we test that a request is idempotent ? Is it enough to just make that request twice and validate the response or do we need to do something more ?

1 Answer 1


Repeating the same request twice and checking you get the same response is enough to give you confidence that the API is idempotent.

However, depending on what the API does under the hood, you might also need to validate that there were no unintended side effects of the second request. For example, you might have an idempotent API that bills a user for an order. Repeating the request should not bill the user for the same order twice in this example.

  • In your example, could it be possible that the server returns the same response, but due to a bug, it actually places the order twice, thereby misleading the API user ? In other words, we need to do maybe a GET orders call to confirm that it is indeed one order ?
    – MasterJoe
    Nov 3, 2017 at 20:03
  • Yes, that kind of bug is certainly possible. As you say, you would need to use something other than the response to see if the response is actually telling the truth or not. Nov 3, 2017 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.