Search code examples
restful-architecturespring-rest

Are all the REST methods idempotent?


In Spring RESTful Web Services, are all the REST (Representational State Transfer) methods idempotent?


Solution

  • No.

    Idempotence guarantees that regardless of how many times a command is entered, the same result applies. This is not possible with commands that alter the state of an application on successive requests, such as POST.

    You as the author of these endpoints are directly responsible for the idempotence of your endpoints. You could make GET requests non-idempotent if you truly felt like it, but there is no guarantee implied in Spring alone that says that these endpoints are guaranteed to be idempotent.