Sunday, November 9, 2008

HTTP Post

It is an erroneous view by many that POST is a more sophisticated form of GET. HTTP standard views POST as a way to request creating an entity in the server. When POST is used, the server can respond in 2 ways:

HTTP 200 or 204 = respond with an acknowledgement and provide no other data
HTTP 201 = indicate the entity has been created and provide more information about the creation

The latter case makes POST appear like a GET.

Static or dynamic GET responses can be cached with uses of HTTP control header such as If-Modified. HTTP 1.1 uses either date or tag (Etag) to validate content from cache. POST is considered as a mutable operation on the server. HTTP methods PUT, DELETE and POST must cause a cache to invalidate its entry. Thus POST is less efficient comparing to GET.

No comments: