The GET method means to retrieve whatever information is identified by the request
Uniform Request Identifier (URI). The term URI may be confusing, especially given the
reference to a URL above, but essentially, for the purposes of this book, just know that
a URL is like a person’s address and is a type of URI which is like a person’s name
(thanks Wikipedia). While there are no HTTP police, typically GET requests should not be
associated with any data altering functions, they should just retrieve and provide data.
The HEAD method is identical to the GET message except the server must not return a
message body in the response. Typically you won’t often see this used but apparently it is
often employed for testing hypertext links for validity, accessibility and recent changes.
The POST method is used to invoke some function to be performed by the server, as
determined by the server. In other words, typically there will be some type of back end
action performed like creating a comment, registering a user, deleting an account, etc.
The action performed by the server in response to the POST can vary and doesn’t have
to result in action being taken. For example, if an error occurs processing the request.
The PUT method is used when invoking some function but referring to an already existing
entity. For example, when updating your account, updating a blog post, etc. Again, the
action performed can vary and may result in the server taking no action at all.
The DELETE method is just as it sounds, it is used to invoke a request for the remote
server to delete a resource identified by the URI.
The TRACE method is another uncommon method, this time used to reflect back the
request message to the requester. This allows the requester to see what is being received
by the server and to use that information for testing and diagnostic information.
The CONNECT method is actually reserved for use with a proxy (a proxy is a basically a
server which forwards requests to other servers)
The OPTIONS method is used to request information from a server about the communication
options available. For example, calling for OPTIONS may indicate that the server
accepts GET, POST, PUT, DELETE and OPTIONS calls but not HEAD or TRACE.
No comments:
Post a Comment