0% found this document useful (0 votes)
19 views

THM - Web Application Basics

Uploaded by

huwi4183
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

THM - Web Application Basics

Uploaded by

huwi4183
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Hsu Wai Lwin Hnin ʚɞ

THM - Web Application Basics


scheme://user@host(domain):port/path?query-string#fragement

http://user:[email protected]:80/view-room?id=1#task3

There are two types of HTTP messages:

HTTP Requests: Sent by the user to trigger actions on the web application.
HTTP Responses: Sent by the server in response to the user’s request.

Start line / Headers / Empty line / Body(actual data is stored)

Start line(Request line) ⟶ METHOD /path HTTP/version

HTTP Methods

GET / POST / PUT / DELETE / PATCH / HEAD / OPTIONS(only retrieves headers) / TRACE /
CONNECT

Common Request Headers ⟶ Host / User-Agent / Referer / Cookie / Content-Type

Common Request Body Formatting ⟶ URL Encoded / Form Data(Multipart) / JSON / XML
Status Codes

Informational Responses (100-199)


Successful Responses (200-299)
Redirection Messages (300-399)
Client Error Responses (400-499)
Server Error Responses (500-599)

Common Status Codes ⟶ 100 (Continue) / 200 (OK) / 301 (Moved Permanently) / 404 (Not
Found) / 500 (Internal Server Error)

Example Actions:

GET /api/users: Retrieve all users.


GET /api/users/{id}: Retrieve a single user by ID.
POST /api/users: Create a new user.
PUT /api/users/{id}: Update an existing user.
DELETE /api/users/{id}: Delete a user.

Real-World Examples

GitHub API:
/users/{username} retrieves public profile information of GitHub users.
Example: https://api.github.com/users/octocat.
Twitter API:
/users/{id} fetches Twitter user details.
Example: https://api.twitter.com/2/users/{id}.
E-commerce API:
/users/{id}/orders retrieves order history for a specific user.

You might also like