Existing customer? Sign in

What is HTTP? or the 8 or 9 HTTP methods?

The Hypertext Transfer Protocol, or HTTP, is the backbone of the World Wide Web. It is a protocol that governs the communication between clients and servers, allowing users to access web pages, images, videos, and other resources over the internet. Simply put, HTTP let web developers link documents together (hyperlinks).

HTTP is a request-response protocol, which means that a client (web browser) sends a request to a server and the server responds with the requested information. This information can be anything from a web page, to an image, to a file. That was how this webpage you are on was loaded. In contrast, the Hieroglyph API will return JSON with infomation about a webpage and a link to s screenshot of that webpage. This client and server communicate using text-based messages, called HTTP messages, contains information about the requested resource, as well as any necessary instructions or parameters.

HTTP messages consist of two parts: the header and the body. The header contains metadata about the message, such as the type of message, the date and time it was sent, and any additional instructions. The body contains the actual content of the message, such as the web page, or file being requested.

When a user types a URL into their web browser, the browser sends an HTTP request to the server hosting the requested resource. The server then processes the request and sends an HTTP response back to the browser. This response contains the requested resource, as well as any additional metadata or instructions.

HTTP also supports a range of different request methods, including GET, POST, PUT, DELETE, HEAD, and OPTIONS. These methods allow clients to perform a variety of operations, such as retrieving resources, submitting data, updating resources, and more.

One of the key features of HTTP is its statelessness. This means that each request is processed independently of any previous requests, and the server does not maintain any information about the client's state or session. Instead, clients can use cookies and other mechanisms to maintain state across multiple requests.

HTTP is the underlying protocol that allows users to access web pages and other resources over the internet. It is a request-response protocol that uses text-based messages, and supports a range of different request methods. Its stateless design allows for scalable and flexible communication between clients and servers, and it continues to evolve to meet the needs of modern web applications.

There are 8 HTTP methods: GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE, and CONNECT. PATCH is often considered the 9th HTTP method, but it is technically a variation of PUT. The difference between PUT and PATCH is that PUT is used to update or replace and entire resource, while PATCH is for updating only specific fields of a resource while not changing its other fields. The HTTP methods are defined by the Internet Engineering Task Force (IETF - https://www.ietf.org) and the World Wide Web Consortium (W3C https://www.w3.org). Link to the HTTP/2 specification: https://datatracker.ietf.org/doc/html/rfc7540 The HTTP header is part of the HTTP request and response message that contains metadata about the content type, language, etc. How to run a curl command of how to PATCH the title of a blog post to be different. This is if the blog post has and Id of 1234 and is at the url /blog/id# ``` curl -X PATCH -H "Content-Type: application/json" -d '{"title": "New Blog Post Title"}' https://example.com/blog/1234 ``` The -X flag specifies the HTTP method of the request is PATCH. The -H flag adds a custom header to the request which says the data is JSON The -d specifies the body of the request which is a JSON string.