Why Rest webservice use Http verbs for CRUD ooperation? What is the advantage of rest webservice over RPC style webservice. When we creating webservice We must add logic for select,insert,Update and delete. Then why we use HTTP verbs rather than normal methods? for example in rest we could create a method for updating the resources with PUT method.
public void Put(int id, Employee employee)
{
// Logic for update operation
}
When we use normal method :
public void UpdateById(int id, Employee employee)
{
// Logic for update operation
}
In this Both method have the same data logic. Than what is the importants of PUT
method here?
Why we use DELETE
verbs to delete resources? We must use the logic for delete a resource inside the DELETE
method. Then why should we use DELETE
instead of PUT,GET,POST
? Even if we use any of the verbs we must implement the data logic. Then why should we use PUT
for update, DELETE
for deletion, POST
for creation? Can we change each other?