en

HTTP PUT is a request method that creates or fully replaces a resource at a known URL. The client sends a new representation of the resource to that address, and the server stores it in full at the given path.

Idempotency of PUT

The key property of PUT is idempotency: repeating the same request produces the same result. Send PUT twice and you will not create two copies — the resource is simply overwritten with the same data. This sets PUT apart from POST, which usually creates a new object each time. Like every HTTP method, PUT is stated at the start of the request together with the path and headers.

PUT, POST and GET

To pick a method it helps to compare their behaviour:

  • PUT — fully replaces a resource at a known address and is idempotent.
  • POST — creates a new resource, the server assigns the address; not idempotent.
  • GET — only reads data and does not change server state.

PUT is handy when the client knows the exact URL and wants to replace the whole content; for partial changes the PATCH method is used. Sending data is safer over HTTPS.

HTTP PUT: creating or fully replacing a resource at a URL
Learn more

Tag cloud