What are RESTful web services? [duplicate]

2019-01-16 06:33发布

问题:

Possible Duplicate:
What exactly is RESTful programming?

What are RESTful web services? What would be an example of it?

What is the difference between the asmx web services and the WCF RESTful service?

回答1:

You can check out Roy Fielding's (the creator of the REST architectural style) wiki page here and then move on to his PhD dissertation here and finally for a quick example just take a look at the Twitter API.



回答2:

REST is a client-server architecture which (among other things) leverages the full capacity of the HTTP protocol.

Some relevant points in REST:

  • Each URL on the server represents a resource; either a collection resource or an element resource.
    • A collection resource would be available at a URL like http://restful.ex/items/ which would be a representation of a list of items.
    • A element resource would be available at a URL like http://restful.ex/items/2 which would be a representation of a single item, identified by 2.
  • Different HTTP methods are used for different CRUD operations:
    • a GET is a read operation
    • a PUT is a write/modify operation
    • a POST is a create/new operation
    • a DELETE is a... ok, that one is kind of self-explanatory.
  • State (or rather, client context) is not stored on the server-side; all state is in the representations passed back and forth by the client's requests and the server's responses.


回答3:

It's basically web services that implement CRUD using the HTTP methods(GET, POST, PUT, DELETE)



回答4:

RESTful webservices use HTTP methods explicitly by mapping the REST operations to HTTP methods:

  • Create - POST
  • Retrieve - GET
  • Update - PUT
  • Delete - DELETE

Here is a link to a good summary.



回答5:

Check description of REST. Web services conforming to this principle are called RESTful.