Here is the list of methods used to send the request to the server:
1. GET
2. POST
3. PUT
4. DELETE
5. PATCH
6. HEAD
7. OPTIONS
8. TRACE
From the above list Head, Options, Trace are used very rarely.
Below is the details for each method:
GET: When you want to retrieve some data from the server, use GET method.
For eg: To fetch the deatil of a bug from the JIRA server, use GET method.
POST: When you want to create new resource to the server, use POST method.
For Eg: In JIRA tool, if you want to add new bug, use POST method.
PUT: When you want to update some data to the existing resource, use PUT method. In this user needs to send the complete data set together.
For Eg: If user want to update the summary of a existing bug, needs to send the Bug Id, Bug Name, Update Bug Summary etc.
DELETE: When you want to delete some data or some resource from the server, use DELETE method.
PATCH: Patch is almost same as put method (used to update some data to the existing resource). The only difference in Patch is only updated data needs to be sent with no other details.
HEAD: Head is used when you want to get only header in the response from the server like cookie, content type of response etc.
OPTIONS: This method gives the list of methods that can be used to hit the API to retrieve the data.
TRACE: Trace is used to check the format to the request, whatever we are sending to the server, can retrieve the same. Basically used for the debugging purpose.
No comments:
Post a Comment