HTTP Methods

 

What is HTTP Verb?

HTTP verbs are technically correct terms of request, and it communicates the action a user intends to take on specific resources related to these verbs and methods. HTTP password processing is very common.

GET, POST, PUT, PATCH, DELETE, OPTIONS, and HEAD are the key HTTP most commonly used verbs used with RESTful services.



HTTP GET

The GET request was used to obtain information on resources and is not subject to any other means. The GET API should be malicious. This simply means that every API that makes similar requests should return the same result until the resource status of the server is changed. GET requests are made securely because they do not change the status of the resource.

Example URI - HTTP GET http://www.abc.com/users


HTTP POST 

The HTTP POST method is used to create relevant resources. POST request methods are insecure. In this case, when two similar post requests are made, there may be two different resources related to the same information.

Example URI - HTTP POST http://www.abc.com/users

HTTP PUT
Uses the HTTP PUT method to update an existing resource. If the URI refers to an existing resource, it should be considered as an updated resource on the server. If Request-URI is not an existing resource, the original client has the ability to create resources with that URI.

Example URI - HTTP PUT http://www.abc.com/users/1

HTTP DELETE
This method is used to delete resources from a server. When a delete request is made, the server performs a deletion. DELETE methods are unsafe.

Example URI - HTTP DELETE http://www.abc.com/users/1
 


                GET                                                                POST
  • Parameter in URL                                          Parameters in body
  • Used for fetching the document                     Used for updating data  
  • Maximum URL length                                    No max length 
  • Remain in the browser history                      Not remain in the browser history
  • Can be cached                                       Requests are never cached
  • Can be bookmarked                                     Cannot be bookmarked


HTTP Status Codes



The HTTP code looks like the following
200 - OK *
201 - Created *
202 - Accepted
204 - No content *
301 - Moved permanently
302 - Found
304 - Not modified *
400 - Bad request *
401 - Unauthorized *
403 - Forbidden *
404 - Not found *
405 - Method not allowed
409 - Conflict *
412 - Precondition failed
500 - Internal server error *
502 - Bad gateway
503 - Service unavailable







Comments

Popular posts from this blog

KoaJS in NodeJS

S.O.L.I.D Principles