CodingNic

Web Fundamentals

HTTP Methods

Web Fundamentals 10 min read

HTTP Methods

HTTP Methods

HTTP methods define the type of action a client wants to perform on a server.

They are a key part of how web applications communicate and interact with data.

What are HTTP Methods?

When a client sends a request, it includes a method that tells the server what to do.

Common methods include:

  • GET
  • POST
  • PUT
  • DELETE

Each method has a specific purpose.

GET

GET is used to retrieve data from the server.

  • Does not modify data
  • Used for fetching pages or data
  • Example: loading a website

POST

POST is used to send data to the server.

  • Creates new data
  • Often used in forms
  • Example: creating a new user account

PUT

PUT is used to update existing data.

  • Replaces existing data
  • Sends the full updated resource
  • Example: updating a user profile

DELETE

DELETE is used to remove data from the server.

  • Permanently deletes a resource
  • Example: deleting a post or account

How Methods Fit into the Web

HTTP methods work within the request–response cycle.

HTTP Request Diagram

The method tells the server how to handle the request.

Why This Matters

When building applications:

  • Flask routes can handle different methods
  • FastAPI defines endpoints based on methods
  • Django uses methods to control views

Using the correct method ensures your application behaves correctly and follows best practices.

Summary

  • HTTP methods define the action of a request
  • GET retrieves data
  • POST creates data
  • PUT updates data
  • DELETE removes data

In the next lesson, you’ll learn about HTTP status codes and how servers communicate results.