- HTTP is the acronym for Hypertext Transport Protocol, a standard protocol that allows information to be shared over computer networks.
HTTP is the acronym for Hypertext Transport Protocol, a standard protocol that allows information to be shared over computer networks.
Understanding the different HTTP verbs is crucial for getting the most out of your web browser, as well as being able to control the behavior of a website’s API. Below are the most common verbs used in HTTP requests along with their associated action:
For example, when you access your Gmail inbox and see the blue header with the “G” in it that says “GET” on top of your name, this means instructions are being sent for a GET request to be issued to your Gmail inbox. If you see an instruction like “POST” or “DELETE” in your browser’s window title bar, this means information is being sent for a POST or DELETE request respectively. Every HTTP request has one or two verbs associated with it.
What are the different HTTP Verbs?
GET: This request sends some data back to the client. The data can be a single resource, like a webpage, or an array of resources. The response from this request does not contain any metadata, just the result of the request itself (the data). All GET requests must always include both “accept” and “content-length”. For example, when you enter http://google.com into your web browser’s address bar and hit enter, Google is sending an HTTP GET request to server1.google.com in order to get the HTML source code for the homepage of Google (i.e., index html).
POST: This request adds new data to the resource identified by the “url” attribute. All POST requests must always include both “accept” and “content-length”.
PUT: This request has two possible forms depending on if it is acting as a client or server. If acting as a client, and if they have not specified a content-type to send the data in, then they will receive their entire body back as is. If acting as a server, and if they have specified a content-type for the request, then they will use that type instead of the one that was sent. This might include using multipart types or uploading an arbitrary file.
DELETE: This request deletes data from the resource identified by “url”. Usually GET can be used in its place to return no data. DELETE requests must always include both “accept” and “content-length”.
OPTIONS: This request describes how things are supposed to work on this resource. It is only sent when the browser makes a request. This request must always include both “accept” and “content-length”.
HEAD: This request is identical to GET, except that the server does not return any content to you. You might use this when doing HEAD requests to check if a resource exists without wasting bandwidth.
TRACE: This request logs all the data it passes back and forth for debugging purposes. It’s best not to use it unless you know what you’re doing, as most modern browsers don’t even support it anymore!
CONNECT: This request forces the connection to be made over https even if it was originally going to be http. Many browsers will automatically do this for you if the content-type is https.
OPTIONS: This request describes how things are supposed to work on this resource. It is only sent when the browser makes a request. This request must always include both “accept” and “content-length”.
Learn more about how HTTP works here.
To read more on microservices, see this article.