开发者

What are RESTful web services? [duplicate]

开发者 https://www.devze.com 2023-01-14 22:42 出处:网络
This question already has answers here: Closed 12 years ago. Possible Duplicate: What exactly is RESTful programming?
This question already has answers here: Closed 12 years ago.

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 servi开发者_JS百科ces and the WCF RESTful service?


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.


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.


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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消