# REST vs. HTTP

Two of the most confusing and misunderstood concepts used by everyday web developers are HTTP and REST, because there are developers who have worked for decades in this industry and still do not know the differences between those two. We are going to clear that up before moving onto the details of what REST and HTTP actually are.

**REST** is an **architectural style guideline** which enforces the correct use of the HTTP transport protocol. **HTTP** is a communications **protocol** that transports messages over a network. The HTTP 1.1 protocol was built to be the ideal protocol to follow the principles and constraints of REST.

One way to look at the relationship between HTTP and REST is that **REST is the design**, and **HTTP 1.1 is an implementation** of that design. In reality the two were designed simultaneously.

So are REST and HTTP the same? No, they are not. HTTP stands for HyperText Transfer Protocol and is a way to transfer files. This protocol is used to link pages of hypertext on the world-wide-web. However, there are other transfer protocols available like FTP and [Gopher](https://en.wikipedia.org/wiki/Gopher_\(protocol\)). Representational State Transfer, or REST, is a set of constraints that ensure a scalable, fault-tolerant and easily extensible system.

One thing that confuses people, is that REST and HTTP seem to be used hand-in-hand. After all, the world-wide-web itself runs on HTTP, and it makes sense. However, there is nothing in the REST constraints that make the usage of HTTP as a mandatory transfer protocol. It's perfectly possible to use other transfer protocols like SMTP, SMS, or even Bluetooth. An API could use any protocol and could still very well be a RESTful API.

In practice, most - if not all - RESTful APIs currently use HTTP as a transport layer, since the infrastructure, servers, and client libraries for HTTP are widely available already.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.restfulnode.com/part-2/chapter-2/2-rest-vs-http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
