A lot of people think there is a hard and fast rule that POST is to create and PUT is to update. This is not entirely true as they can be used interchangeably. The key difference between these verbs is their idempotence as described in RFC 2616. The idea of idempotence is also reflected in the target of these verbs, for example:
- POST generally goes to a generic address such as /articles/ and a new article is spawned, for example /articles/42.
- PUT goes to a specific address such as /articles/12 and updates that resource.
To sum it up, PUT can be run once or a thousand times and the end result will be the same. POST on the other hand always has side effects and this is the main difference between the two.
Hey, like this post? Why not share it with a buddy?Tweet