HTTP-Method
The HTTP-Method (also known as an HTTP verb) indicates the desired action to be performed for a given Resource. Each method implements specific semantics to ensure that Client and Server communication follows a predictable pattern. These methods are defined by the IETF in various RFC documents, most notably RFC 7231.
Primary HTTP Methods
- GET: Used to retrieve data from a server at the specified URL. It is considered a Safe-Method because it does not modify the state of the resource.
- POST: Used to send data to the server to create a new resource or trigger a specific processing action. Unlike GET, POST requests often result in a change in state.
- PUT: Replaces the current representation of the target resource with the uploaded content. It is Idempotent, meaning multiple identical requests should have the same effect as a single request.
- DELETE: Removes the specified resource from the server.
- PATCH: Applies partial modifications to a resource, offering a more efficient alternative to PUT when only small changes are needed.
- HEAD: Identical to GET but only transfers the status line and header section, omitting the response body.
- OPTIONS: Describes the communication options for the target resource, often used in CORS preflight requests.
Understanding the properties of these methods, such as whether they are Cacheable or Idempotent, is essential for API-Design and REST architecture. For more technical details, developers often refer to the MDN Web Docs.