Difference between PUT vs POST from a system administrator POV?

  • Thread starter Thread starter oslon
  • Start date Start date
AI Thread Summary
Understanding the difference between PUT and POST is crucial for effective use of HTTP methods in web development. PUT is idempotent, meaning that repeated requests with the same input yield the same output, making it reliable for updating resources without unintended side effects. For example, using PUT to update a resource at a specific path will overwrite existing data consistently, while POST is more flexible and can create new resources or modify existing ones without a guaranteed outcome, leading to potential duplication if the same request is made multiple times.The discussion highlights that POST is often used to add items to collections, but it lacks the strict resource identification that PUT provides. This distinction is important for system administrators and developers, as it affects how data is managed and manipulated within applications. The idempotency of PUT ensures that even if a request is sent multiple times due to errors, the state of the resource remains unchanged, which is a significant advantage in maintaining data integrity.
oslon
Messages
3
Reaction score
0
TL;DR Summary
Difference between PUT vs POST from a system administrator POV?
I believe it’s important to learn concepts from a POV of X, when trying to learn something very confusing that could mean multiple meanings.

These are what I wrote in my college notes of TCP IP that I did 6 years ago.
pjTMxFbLZkOSy0G4xuXkg7hhnmpEoOBnxOoGuzBZUqeOYv6HFk.png

Much of it is confusing as both seem to be doing the same thing.
Can you tell me what’s the benefit of being idempotent? As far as I know idempotent means no matter how many times you repeat a input, you get same output.
 
Technology news on Phys.org
With PUT /path, the server accepts the data and MUST store it in /path. Making the same request again will overwrite everything in /path.

Then we can do:

GET /path to retrieve existing data;
DELETE /path to delete existing data;
PATCH /path to update only part of existing data.

I guess it makes more sense if one views these as applied to files on a server.

Initially POST was supposed to create a new set of data such as POST /customers or POST /articles for creating new customers or articles, but without identifying a URI to reach it (such as GET /article/{article-id} or GET /article?id={article-id}); it may not have one at all. You were supposed - but not obligated - to add an item to an already existing collection normally defined as /path.

With POST /path, the server accepts the data and does whatever it wants with it. This flexibility lead to use it for simulating a PUT, GET, DELETE, or PATCH with it.
 
oslon said:
TL;DR Summary: Difference between PUT vs POST from a system administrator POV?

These are what I wrote in my college notes of TCP IP that I did 6 years ago.
TCP is a lower layer of the internet protocol, the transport layer. PUT and POST are commands one layer up in the application layer, including such protocols as HTTP, HTTPS, and others.

From this page -- https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/PUT -- it says:
PUT
The HTTP PUT request method creates a new resource or replaces a representation of the target resource with the request payload.

The difference between PUT and POST is that PUT is idempotent: calling it once or several times successively has the same effect (that is no side effect), whereas successive identical POST requests may have additional effects, akin to placing an order several times.
 
  • Like
  • Haha
Likes PeterDonis and oslon
oslon said:
Can you tell me what’s the benefit of being idempotent?
Nothing bad happens if (perhaps due to a communications error) the message is processed more than once.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
hi; i purchased 3 of these, AZDelivery 3 x AZ-MEGA2560-Board Bundle with Prototype Shield and each is reporting the error message below. I have triple checked every aspect of the set up and all seems in order, cable devices port, board reburn bootloader et al . I have substituted an arduino uno and it works fine; could you help please Thanks Martyn 'avrdude: ser_open(): can't set com-state for "\\.\COM3"avrdude: ser_drain(): read error: The handle is invalid.avrdude: ser_send(): write...
Back
Top