Different type of HTTP methods and HTTP error code

 Different type of HTTP(Hypertext Transfer Protocol) methods

HTTP  is the protocol used for communication between a client and a server. There are different type of HTTP methods that can be used to make requests to a server.

  • GET: It is used to retrieve data from a server without modifying the resource.
  • POST: It is used to send data to a server to create a new resource or update an existing one.
  • PUT:  It is similar to POST, but it is typically used to update existing resources.
  • DELETE: Deletes the resource identified by the URI.
  • PATCH: It is used to update only specific fields of a resource, rather than replacing the entire resource.
  • HEAD: It is used to retrieve metadata about a resource without retrieving the resource itself.
  • OPTIONS: It is used to check which methods can be used to make a request to a specific URI.
  • CONNECT:It is primarily used for tunneling HTTPS requests through a proxy server.
  • TRACE: It is used for debugging and troubleshooting.

All these methods are used to perform different actions on a resource, like creating, reading, updating or deleting a resource on a server.


 Different type of HTTP status code

HTTP status codes are three-digit numbers returned by a server in response to a request made by a client. They indicate the outcome of the request and provide information about the state of the resource being accessed.

  1. 1xx (Informational): Its comes when request has been received and is being processed.
  2. 2xx (Successful): Its comes when request was successful and the requested information has been returned.
    • 200 OK: Its comes when request was successful and the requested information has been returned.
    • 201 Created: Its comes when request was successful and a new resource has been created as a result.
    • 204 No Content: Its comes when request was successful but no information needs to be returned.
  3. 3xx (Redirection): Its comes when client needs to take additional action in order to complete the request.
    • 301 Moved Permanently: Its comes when requested resource has been permanently moved to a new location.
    • 302 Found: Its comes when requested resource has been temporarily moved to a new location.
    • 304 Not Modified: Its comes when requested resource has not been modified since the last request.
  4. 4xx (Client Error): Its comes when there was an error with the request made by the client.
    • 400 Bad Request: Its comes when request was malformed or otherwise incorrect.
    • 401 Unauthorized: Its comes when request requires authentication and the client did not provide valid credentials.
    • 403 Forbidden: Its comes when client does not have access to the requested resource.
    • 404 Not Found: Its comes when requested resource could not be found.
    • 405 Method Not Allowed: Its comes when requested method is not supported by the resource.
    • 409 Conflict: Its comes when request could not be completed due to a conflict with the current state of the resource.
  5. 5xx (Server Error): Its comes when there was an error with the server processing the request.
    • 500 Internal Server Error: An unexpected error occurred on the server.
    • 503 Service Unavailable: Its comes when the server is currently unable to handle the request due to maintenance or overload.

These codes are used to inform the client about the status of their request and give them information about what actions they need to take next. They also can be used by developers to troubleshoot the issues in their application.





Post a Comment

0 Comments