1

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?

folk
  • 687
  • 3
  • 8
  • 16
  • REST is far more that just using HTTP verbs and no, not every resource needs to support every verb (e.g. you cant PUT to a [paged atom feed](http://tools.ietf.org/html/rfc5005), but it's an excellent example of a RESTful interface. To get a better understanding of REST, have a look at http://martinfowler.com/articles/richardsonMaturityModel.html – Tom Howard Oct 24 '13 at 13:15

1 Answers1

0

Short answer: Using HTTP verbs is the normalized and standardized way to provide an uniform interface.

Rest is all about the resources and how to manage them in a scalable way (Internet scale).

  • POST is for creating a new resource
  • PUT is for modifying an existing resource

You can read rest-api-why-use-put-delete-post-get for more info.

In addition, Rest concerns about the following (copied from RESTful Web Services)

  • Addressability
  • Statelessness
  • Representations
  • Links and Connectedness
  • The Uniform Interface

Two great books on rest.

Community
  • 1
  • 1
Ming Chan
  • 1,938
  • 11
  • 21