# HTTP

## Request Methods

Common and often used HTTP request methods you should know. Read more [here](https://httpwg.org/specs/rfc9110.html#methods).

<table><thead><tr><th width="198">Method</th><th>Description</th></tr></thead><tbody><tr><td>GET</td><td>Send named resource from the server to the client.</td></tr><tr><td>HEAD</td><td>Send just the HTTP headers from the response for the named resource.</td></tr><tr><td>POST</td><td>Send client data into a server gateway application.</td></tr><tr><td>PUT</td><td>Store data from client into a named server resource.</td></tr><tr><td>DELETE</td><td>Delete the named resource from a server.</td></tr></tbody></table>

## Status Codes

Common and often used HTTP status codes you should know. Read more [here](https://httpwg.org/specs/rfc9110.html#status.codes).

### 2xx

These status codes indicate that the request was successfully received, understood, and accepted.

<table><thead><tr><th width="225">Code</th><th>Description</th></tr></thead><tbody><tr><td>200 OK</td><td>Standard response for successful HTTP requests.</td></tr><tr><td>201 Created</td><td>The request succeeded and a new resource was created. Often used after a successful <code>POST</code> request.</td></tr><tr><td>204 No Content</td><td>The request succeeded but no content was returned. Might be used after a successful <code>DELETE</code> request.</td></tr></tbody></table>

### 3xx

These status codes indicate a redirection and that further action needs to be taken by the user agent in order to fulfill the request.

| Code                  | Description                                                                                                 |
| --------------------- | ----------------------------------------------------------------------------------------------------------- |
| 301 Moved Permanently | The URL of the requested resource has been changed permanently and the new URL is provided in the response. |
| 304 Not Modified      | The response was cached and has not been modified.                                                          |

### 4xx

These status codes indicate that there occured an error on the client side.

<table><thead><tr><th width="232">Code</th><th>Description</th></tr></thead><tbody><tr><td>400 Bad Request</td><td>The server cannot process the received request from the user. For example if a form value is invalid.</td></tr><tr><td>401 Unauthorized</td><td>Equivalent to "unauthenticated". The client must authenticate itself. For example via <a href="https://jwt.io/">JWT</a>.</td></tr><tr><td>403 Forbidden</td><td>The client does not have access rights to the content.</td></tr><tr><td>404 Not Found</td><td>The requested resource does not exist on the server side.</td></tr></tbody></table>

### 5xx

These status codes indicate that there occured an error on the server side.

| Code                      | Description                                                                    |
| ------------------------- | ------------------------------------------------------------------------------ |
| 500 Internal Server Error | The server encountered an unexpected condition and cannot fulfill the request. |

## Further Resources

Read more here:

* [RFC 9110](https://httpwg.org/specs/rfc9110.html#top)
* [HTTP: The Definitive Guide](https://www.oreilly.com/library/view/http-the-definitive/1565925092/)


---

# 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.larswaechter.dev/cheatsheets/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.
