HTTP Methods for RESTful Services
These correspond to create, read, update, and delete (or CRUD) operations
POST — Create
GET — select
PUT — Update/Replace
PATCH — Update/Modify
DELETE — Delete
difference between put and post
PUT method is idempotent. So if you send retry a request multiple times, that should be equivalent to single request modification.
POST is NOT idempotent. So if you retry the request N times, you will end up having N resources with N different URIs created on server.
HTTP response status codes
Informational responses (100–199),
Successful responses (200–299),
Redirects (300–399),
Client errors (400–499),
and Server errors (500–599).
Http Status Code Registry
Question : What are Idempotent Methods in HTTP
These are methods which are safe from multiple calls i.e. they produce same result irrespective of how many times you call them.
They change the resource in Server every time you call them but the end result is always same.
What is Safe Methods in HTTP
These are HTTP methods which don’t change the resource on the server side. For example using a GET or a HEAD request on a resource URL should NEVER change the resource. Safe methods can be cached and prefetched without any repercussions or side-effect to the resource . Here is an example of safe method
Question : If user try to hit rest api with wrong username and password ? — 401 response indicates that authorization has been refused for those credentials.
Question . What Is Idempotent Methods And Web Applications?Answer :Methods PUT and DELETE are defined to be idempotent, meaning that multiple identical requests should have the same effect as a single request. Methods GET, HEAD, OPTIONS and TRACE, being prescribed as safe, should also be idempotent, as HTTP is a stateless protocol.
Question . What Is The Mean Of 500 Internal Server Error Http Response Codes? Answer :When all else fails; generally, a 500 response is used when processing fails due to unanticipated circumstances on the server side, which causes the server to error out.
Question. What Is The Mean Of 409 Conflict Http Response Codes?Answer :This indicates a conflict. For instance, you are using a PUT request to create the same resource twice.
Qu. What Is The Mean Of 405 Method Not Allowed Http Response Codes?Answer :The HTTP method used is not supported for this resource.
Qu. What Is The Mean Of 401 Unauthorized Http Response Codes?Answer :This error indicates that you need to perform authentication before accessing the resource.
Qu. What Is The Mean Of 400 Bad Request Http Response Codes?Answer :The request was malformed. This happens especially with POST and PUT requests, when the data does not pass validation, or is in the wrong format.
Qu. What Is The Mean Of 404 Not Found Http Response Codes?Answer :This response indicates that the required resource could not be found. This is generally returned to all requests which point to a URL with no corresponding resource.
Qu.What Is The Mean Of 400 Bad Request Http Response Codes?Answer :The request was malformed. This happens especially with POST and PUT requests, when the data does not pass validation, or is in the wrong format.
Qu. . What Is The Mean Of 201 Created Http Response Codes?
Answer :This indicates the request was successful and a resource was created. It is used to confirm success of a PUT or POST request.
Qu.What Is 200 Ok Http Response Codes?
Answer :This response code indicates that the request was successful.
Qu. What Are The Safe And Unsafe Methods Of Http?
Answer :safe methods are those that never modify resources. The only safe methods, from the four listed above, is GET. The others are unsafe, because they may result in a modification of the resources.