Close

HTTP Request Methods

[Last Updated: Feb 11, 2016]

Web HTTP 

Also known as: HTTP verbs

HTTP defines methods to indicate the desired action to be performed on the target resource.

GET: It is used to retrieve resource data i.e it's read only request. Some limited data can be sent to the server in the query string so that the server can fine tune or filter the response. GET can also be submitted through an HTML form, in that case too form data is sent via query string.

POST: This method submits data to be processed (e.g., from an HTML form) to the target resource. The data is included in the body of the request (opposed to query string in GET method). This may result in the creation of a new resource or the updates of existing resources or both.

PUT: This method requests the server to create a new resource at the requested URI (that means the URI doesn't exist before the request). It may also result in updating the resource if resource already exists. In case of updating resources, we have to provide all fields, including those that won't change.

HEAD: The HEAD method is identical to GET except that the server doesn't return a message-body in the response. This is useful for retrieving meta-information written in response headers, without having to transport the entire content.

OPTIONS Method: This returns the list of HTTP methods that the server supports for the specified URI.

DELETE: It deletes the specified resource. This operation is Idempotent.

TRACE: This method is used for debugging which echos input back to the user.

CONNECT: This method is used when connecting to a host via a HTTP Proxy Server. The request asks the proxy to establish an HTTP tunnel to the target end-point. Once the connection has been established by the server, the Proxy server continues to proxy the TCP stream to and from the client.

PATCH: This is used to update partial resources. For instance, when we only need to update one field of the resource. It's not correct to use PUT for partial updates. PUT request replaces a resource completely, ignoring the current state of the resource. A PATCH request asks the server to maintain the current state of the resource but update few fields.

We can always use JavaScript or JQuery or any web client which supports above methods. As of HTML5 specs, HTML forms only support POST and GET methods.