What is the purpose of the POST method in REST?
A) To create a new resource on the server
B) To update an existing resource
C) To delete a resource
D) To retrieve a resource
Answer:
A) To create a new resource on the server
Explanation:
The POST method in REST is used to create a new resource on the server. When a client sends a POST request, it typically includes data in the body of the request, which the server uses to create a new resource. Unlike GET requests, POST requests can modify the state of the server by adding new resources.
POST is not idempotent, meaning that sending the same POST request multiple times may result in multiple resources being created. Therefore, POST is generally used when creating new resources or submitting data that does not already exist on the server.