Rajnish Jangid
What is difference between POST , GET HTTP methods

GET is for fetching data, appending parameters in the URL, ideal for searches. POST, used for updates, sends data securely in the request body
Operation: GET Method: Used to retrieve information from the server. POST Method: Used to create or update a resource.
Data Location: GET Method: Appends data to the URL, visible to all.
POST Method: Includes data in the request body, not displayed in the URL.
Idempotency: GET Method: This is meant to be Idempotent, the same request can be repeated with no further changes, and should not have any affect on server state.
POST Method: Mostly this is Non-Idempotent since it might affect server state, but can also be idempotent in few cases based on server implementation.
Request Size : GET - Request sizes are usually small, since request data is mostly sent in url itself.
POST - Request size can vary. Maximum sizes can depend on permissible limits provided by the server. For ex - Apache can support a maximum limit of 2GB.
Caching: GET Method: Can be cached, leading to better performance.
POST Method: Not cached by default, as these are not idempotent in general.
Security: GET Method: Less secure as data is exposed in the URL.
POST Method: More secure; data is concealed within the request body.

By Rajnish Jangid in .NET on Jul 15 2024
  • Darshan Adakane
    Jul, 2024 26

    The POST and GET HTTP methods are two of the most commonly used methods for requesting resources from a server. Let’s take and sample to understand it better Sure, let's use a common scenario involving an online shopping website.GET Method Scenario: Searching for a product on an online store.When you type a search term into the search bar and hit "Search," your browser sends a GET request to the server to retrieve the relevant product listings. GET URL : https://onlinestore.com/search?query=laptopIn this example, "laptop" is the search term. The server processes this request and returns a list of laptops.POST Method Scenario: Placing an order on an online store.When you fill out an order form with your shipping details and payment information and click "Submit," your browser sends a POST request to the server to process the order.POST URL: https://onlinestore.com/orderThe server processes this data, confirms the order, and returns a confirmation message with details of your order.summary: GET: When you search for a product, your browser retrieves information from the server. POST: When you place an order, your browser sends your order details to the server for processing.Hope this helps.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS