Home > Net >  use case of POST as a non idempotent http request method
use case of POST as a non idempotent http request method

Time:09-01

Why would one use POST at all if PUT can be used to create and update records and is idempotent. in what case would you not want the idempotency?

CodePudding user response:

With PUT the client is deciding the URI of the resource that's being created.

In many cases developers want the server to decide the URI (for example, if the URI contains some incrementing unique database id).

So generally it's a good idea to use PUT to create new resources, unless the server wants full control over the namespace. In practice this is most cases.

  • Related