Difference between PUT vs POST from a system administrator POV?

  • Thread starter oslon
  • Start date
In summary, the main difference between PUT and POST from a system administrator's point of view lies in their intended use and behavior in web applications. PUT is idempotent, meaning multiple identical requests will produce the same result, and it is generally used to update or create a resource at a specific URI. In contrast, POST is not idempotent and is typically used for creating new resources or submitting data that results in changes on the server, often leading to different outcomes with each request. Understanding these distinctions is crucial for effective API design and resource management.
  • #1
oslon
3
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
  • #2
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.
 
  • Love
Likes oslon
  • #3
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
  • #4
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.
 

FAQ: Difference between PUT vs POST from a system administrator POV?

What is the difference between PUT and POST requests in terms of system administration?

PUT is used to update or replace an existing resource, while POST is used to create a new resource on the server. From a system administrator's perspective, PUT requests are idempotent, meaning they can be repeated without changing the result, while POST requests are not.

When should I use a PUT request versus a POST request?

Use a PUT request when you want to update an existing resource with new data. Use a POST request when you want to create a new resource on the server. It is important to consider the idempotent nature of PUT requests when deciding between the two.

How do PUT and POST requests affect system performance?

PUT requests can be more efficient in terms of system performance because they are idempotent and can be repeated without changing the result. POST requests, on the other hand, may require more server resources as they are typically used to create new resources and may involve additional processing.

Can PUT and POST requests be used interchangeably in a system?

While PUT and POST requests both involve sending data to a server, they serve different purposes and should not be used interchangeably. PUT requests are used to update existing resources, while POST requests are used to create new resources. Using the correct request method is important for maintaining the integrity of the system.

How can system administrators ensure the security of PUT and POST requests?

To ensure the security of PUT and POST requests, system administrators can implement authentication and authorization mechanisms to control access to resources. They can also use encryption to protect data transmitted between clients and servers. Additionally, input validation can help prevent malicious data from being processed by the server.

Back
Top