The difference between the HTTP put method and the Post method

Source: Internet
Author: User

Idempotent (idempotent, idempotence) is the concept of an abstract algebra. In a computer, it can be understood that a power-like operation is characterized by the effect that any number of executions have on the same effect as one execution at a time.

When the post is requested, the server creates a file each time, but it simply updates the put method instead of recreating it. So the put is idempotent.

To give a simple example, if there is a blog system to provide a Web API, the pattern is so http://superblogging/blogs/post/{blog-name}, very simple, will {Blog-name} replaced with our blog name, To send an HTTP put or POST request to this URI, the body part of HTTP is the blog post, which is a very simple rest API example. Should we use the Put method or the Post method? Depending on whether the behavior of this rest service is idempotent, what is the server side behavior if we send two http://superblogging/blogs/post/Sample requests? If there are two blog posts, it means that the service is not idempotent, because the use of multiple uses has a side effect, if the latter request to overwrite the first request, then the service is idempotent. In the former case, the Post method should be used, and in the latter case, the put method should be used.

Refer:http the difference between the Put method and the Post method

The difference between the HTTP put method and the Post method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.