HTTP Methods – Which HTTP method should I use and what methods are used in REST

HTTP methods are convenient methods that an outside process can use over simple http transport layer. For example REST (Representational transfer technology) uses http methods to communicate back and forth between resources/entities. There are two basic kinds of http methods – Safe and Idempotent methods. Simply put, safe methods are those methods (GET, HEAD) which are meant just for information retrieval purpose, but not for any kind processing on the resource termination point. While idempotent methods (POST, PUT, DELETE) can be either safe or unsafe, based on the series of actions (sequence) that it invoke in the resource invocation.

OPTIONS method allows to get all available communication options on the request/response chain identified by URI. OPTIONS method is not cacheable.

GET method retrieves whatever information is identified by the request URI and will not contain the source text. GET is cacheable.

HEAD method used to obtain meta information about an entity and does not contain the message body. HEAD method is cacheable.

POST method is used to pass in a chunk of data such as posted form which is meant to be processed by the resource as a close subordinate entity. POST is not cacheable.

PUT method is used to create new resource on the server whereas DELETE is used to remove resource. TRACE is used to invoke a application layer lop back message for the request message.

Article copyright (c) 2010 – Deepesh Joseph (deepeshjoseph@yahoo.com)

Add a Comment

Your email address will not be published. Required fields are marked *