Http Request Methods

Http stands for Hypertext transfer protocol which is just an protocol or a set of rules that helps us to talk with an website or server because it works in the 7th floor of OSI model which is Application layer which consists everything that happens in the front of user. It is used to make any request or send some data like requesting for any webpage or submitting any form to the server side.
https methods are the action commands(commands consisting any actions) that any device sends to the Server like where to redirect the user or what to open or what to do next. It sends a message or request for anything or update anything.
Why http Methods matters for us
https methods:
Powers Website: Let you view, add, update or remove anything from the webpage
Run Apps: let you use features like Online Payment and data sharing
https Methods
There are lots of http methods and some of most important among them are:
GET
Get methods helps us to make a request for representation of any specified resource.
Cases where “Get” request method can be used are:
- Any file or Folder
Any Document
Any Media/Multi-Media
Any Webpage etc.
Head
Head methods also used for making any request but without any response body.
Situation in which “Head” request method can be used are:
The size of a resource on the server.
If a resource exists on the server or not.
The last-modified date of a resource.
Validity of a cached resource on the server.
Post
It is used to submit any entity or element or any data at any location on the server.
The data send to the server is typically in the form of Input:
Input Fields from Online Forms
XML or JSON data
Text data from Query parameters
Case in which “Post” method can be used are:
Post a message to a bulletin board.
Save data from HTML forms to a database.
Calculate a result based on data submitted.
Put
It is used to replace any data available at the server.
Two Rules for the HTTP put request method are:
It always includes a payload that describes a completely new resource definition to be saved by the server in place of existing data.
- The PUT operation uses the exact URL of the target resource position where replacement need to be done.
PUT operations are said to be unsafe but idempotent(one that can be applied multiple times without changing the result beyond the initial application) because:
They are not safe because they change the state of a resource on the server.
They are idempotent because multiple invocations(changes) leave the server in the same state.
Delete
- It is an self-explanatory request method because it is explaining by itself that it will be used to delete anything.
Patch
It also used to replace any available data from the server but efficiently and effectively then Put. And it doesn’t always send a complete resource representation (modifies by getting complete page) instead it only updates the required resource that makes it more efficient and effective.
- It can be used to send a small payload rather than a complete resource representation to the server.
I hope you will like this Blog, and If you found this blog helpful then make sure to hit on the like icon.
Subscribe to my newsletter
Read articles from Manish Saw directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
