Source: Internet
Author: User
Tags response code

Note: This article is a personal study excerpt, the original address is:

An HTTP request was a class consisting of HTTP style requests, request lines, request methods, request URL, header fields, and body content. The most common methods that is used by a client in an HTTP request is as follows:-

1)get:-Used when the client was requesting a resource on the WEB server.

2)head:-Used when the client was requesting some information about a resource and not requesting the resource itself.

3)post:-Used when the client was sending information or data to the server-for example, and filling out an online form (i.e. sends a LA Rge amount of complex data to the Web Server).

4)put:-Used when the client was sending a replacement document or uploading a new document to the WEB server under the request URL .

5)delete:-Used when the client was trying to delete a document from the WEB server, identified by the request URL.

6)trace:-Used when the client was asking the available proxies or intermediate servers changing the request to announce themselves.

7)options:-Used when the client wants to determine and other available methods to retrieve or process a document on the WEB server.

8)connect:-Used when the client wants to establish a transparent connection to a remote host, usually to facilitate ssl-encrypted com Munication (HTTPS) through an HTTP proxy.

The GET Request Method

The GET method is the simplest and the most frequently used request method. It is used to access the static resources, such as HTML documents and images. GET request can be used to retrieve dynamic information by including query parameters in the request URL. For instance, we can send a parameter name with the URL, such as Http:// In this example, Harsh are the dynamic information sent by including a parameter,name, in the request URL. The Web Server can then access this dynamic information through the "name" parameter.

The HEAD Request Method

According to Wikipedia ' asks for the response identical to the one ' would correspond to a GET request, but without the Response body. This was useful for retrieving meta-information written in response headers, without have to transport the entire content .” It was used when the client was requesting some information about a resource and not requesting the resource itself. This means, we have a faster of checking, the headers and some server info for a given resource on the server i.e. Checking if a given URL is serviceable, a given file exists, etc. Sometimes client might only need to view the header of a response (Content-type or content-length). The client can use the HEAD request method to retrieve the header in such cases. The HEAD method is similar-GET method, except that the server does not return a message body (actual page) in response Of the HEAD method.

The POST Request Method

The Post method is commonly used for accessing dynamic resources or when a large amount of complex information are to be SE NT to the server. The Web Server accepts the entity enclosed in the request as a new subordinate of the resource identified by the Request-u RI (Uniform Resource Identifier). According to Wikipedia "submits data to being processed (e.g., from a HTML form) to the identified resource. The data is included in the body of the request. This could result in the creation of a new resource or the updates of existing resources or both. " The major difference between get and POST is so in GET the request parameters be transmitted as a query string appended To the request URL, while in POST the request parameters is transmitted within the body of the request.
The POST request method provides the following functionalities:-
1) Providing annotations of the existing resources.
2) Posting a message to a bulletin board, newsgroup, mailing list, or a similar group of articles.
3) providing a block of data, such as the result of the submitting a form, to a data-handling process.
4) extending a database through an append operation.

The PUT Request method

The PUT method stores an entity in the specified Request-uri. The entity is a resource residing on the WEB server under the specified Request-uri. If The Request-uri does not a existing resource, it is capable of being as a new defined by the resource Ting user, the Web Server can create the resource with that URI. If an existing resource is modified, either the (OK) or 204 (No Content) response code should being sent to indicate SUCCE Ssful modification of a resource. The Web Server must inform the user via the 201 (Created) responses if a new resource is Created. If The resource is isn't created or modified with the Request-uri, a appropriate error response is generated, which reflect s the nature of the problem.

The DELETE Request method

The Delete method requests the WEB server to DELETE the resource identified by the Request-uri. This method is overridden by human intervention, or other means, on the Web Server. If The response includes an entity describing the status of deletion, the (OK) response code specifies that the RESOURC E has been deleted successfully. If The response is 202 (Accepted), it specifies that the resource have not yet been deleted. Similarly, if the response code is 204 (No Content), it specifies the resource have been deleted but the response cod E does not include an entity.

The OPTIONS Request method

According to Wikipedia "Returns the HTTP methods, the server supports for specified URL. This can is used to check for the functionality of a Web server by requesting ' * ' instead of a specific resource. "
The OPTION method requests for information about the communication options available on the Request/response chain Identif IED by a Request-uri. Responses to this method is not cacheable. This method allows the client to determine the options and/or requirements associated with a resource, or the Capabilitie S of a server. If The OPTIONS method includes an entity body, the media type must is indicated by the Content-type field.

The TRACE Request method

According to Wikipedia "echoes back the received request, so that a client can see what (if any) changes or additions has been made by intermediate servers. "
The TRACE method is used to invoke a remote application layer associated with a request message. A TRACE request must not include an entity. A client uses the TRACE method to see the received input at the other end of the request chain and diagnostic or testing I Nformation.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.