Course contentsShow
← Computer Science
Lesson 1516 of 2,87235. Application Layer ProtocolsFree lesson

HTTP Methods: GET and POST

Learning the two most common HTTP methods and their semantics for retrieving and submitting data.

HTTP Methods: GET and POST

You'll learn: The two most common HTTP methods and how they differ in purpose and behavior when communicating with web servers.

What Are HTTP Methods?

HTTP methods (sometimes called "verbs") tell the server what action you want to perform on a resource. Think of them as different types of requests you can make at a restaurant: ordering food, asking for the menu, or requesting your bill. Each serves a different purpose.

GET Method

GET is used to retrieve data from a server. When you type a URL into your browser or click a link, you're typically sending a GET request.

Key characteristics:

  • Purpose: Fetch a resource (web page, image, JSON data, etc.)
  • Data in URL: Any parameters are visible in the URL query string (e.g., ?search=pizza&size=large)
  • Idempotent: Multiple identical GET requests should have the same effect—just retrieving data, never modifying it
  • Cacheable: Responses can be cached by browsers or proxies

Analogy: Like asking a librarian to show you a book. You're not changing anything, just looking.

POST Method

POST is used to submit data to the server, typically to create or update a resource. Think of submitting a form, uploading a file, or posting a comment.

Key characteristics:

  • Purpose: Send data to be processed (create account, submit order, upload file)
  • Data in body: Parameters are sent in the HTTP request body, not visible in the URL
  • Not idempotent: Submitting the same POST twice might create two orders or two accounts
  • Not cacheable: Responses typically aren't cached

Analogy: Like handing the librarian a completed application form to create your library card.

Key Takeaway: Use GET to retrieve data without side effects; use POST to submit data that changes server state. GET parameters go in the URL, POST data goes in the request body.