Enlisted below are some common HTTP methods along with their functions that are supported by RESTful web services.
- GET: Read-only access to the resource.
- PUT: Creation of new resource.
- DELETE: Removal of a resource.
- POST: Update of an existing resource.
- OPTIONS: Get supported operations on the resource.
- HEAD: Returns HTTP header only, nobody.
In RESTful web services, there are several HTTP methods commonly used to perform different actions on resources:
- GET: Used to retrieve data from the server. It should be idempotent, meaning multiple identical requests should have the same effect as a single request.
- POST: Used to create new resources on the server. It submits data to be processed to a specified resource. Unlike GET, it’s not idempotent.
- PUT: Typically used to update existing resources or create a new resource if it doesn’t exist at the specified URL. It’s idempotent, meaning that if you PUT the same resource multiple times, the state of the resource on the server should be the same as after the first PUT.
- DELETE: Used to remove resources from the server. It deletes the specified resource.
- PATCH: Used to apply partial modifications to a resource. It’s used when you want to apply a partial update to a resource.
- HEAD: Similar to GET, but it only retrieves the headers of the response without the body. It’s often used to check for the existence of a resource or to retrieve metadata about a resource.
- OPTIONS: Used to describe the communication options for the target resource. It returns the HTTP methods that the server supports for the specified URL.
These methods allow for different actions to be performed on resources in a RESTful manner, adhering to the principles of statelessness, uniform interface, and scalability.