HTTP (Hypertext Transfer Protocol) is the foundation of how data communicates on the web. It defines how messages are formatted and sent, and how the recepients should respond to various requests.
GET
, POST
, PUT
, and DELETE
.
However, our focus in this workshop will be only GET
and POST
.200 OK
– Request was successful.400 Bad Request
– The server could not understand the request due to invalid syntax. 401 Unauthorized
– User authentication is required and has failed or has not been
provided.403 Forbidden
– The server understood the request, but refuses to authorize it.404 Not Found
– Requested resource or page was not found.Content-Type:text/html;
specifies the
media type
is text as html code.Request:
GET /index.html HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0
Response:
HTTP/1.1 200 OK
Content-Type: text/html
<html>
<head><title>Example</title></head>
<body><h1>Hello, World!</h1></body>
</html>
Start the challenge!